From patchwork Fri Jun 22 06:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10481329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BD1960380 for ; Fri, 22 Jun 2018 06:23:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D8AE28355 for ; Fri, 22 Jun 2018 06:23:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2223D28D9A; Fri, 22 Jun 2018 06:23:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAEB128355 for ; Fri, 22 Jun 2018 06:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750987AbeFVGXu (ORCPT ); Fri, 22 Jun 2018 02:23:50 -0400 Received: from mout.gmx.net ([212.227.15.18]:57333 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbeFVGXt (ORCPT ); Fri, 22 Jun 2018 02:23:49 -0400 Received: from localhost.localdomain ([122.224.77.194]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MJByE-1fUbqu2t58-002pah; Fri, 22 Jun 2018 08:23:43 +0200 From: Chengguang Xu To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, idryomov@gmail.com, Chengguang Xu Subject: [PATCH] ceph: restore ctime as well in the case of restoring old mode Date: Fri, 22 Jun 2018 14:22:37 +0800 Message-Id: <20180622062237.31552-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:4+0YRwfa2N0ISZpCRAm4zMXa2QALGK9MozdD1IXB8bxGgI8VOxS zZ/zzSOfsCZJxsvikSMJe9SQPQLAUlBxyVbfK+aaJw7faR3WXJJjRRFc7w6rOHptzIH2t+F c2Ge0dP8xco9aHnAdbBmtqo2CuRX/l1nVSaSeF7faVAJUQSh46BKnMQF/BYZ0qGUPWd2ZrU YAwoA1wLyNsT+HXiL/5Uw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Tfcn9owNnMM=:tyj3E9QwZEvc1KUnyF1hrq s5dpXcehi5rVZhxwLHP6/GUpsflad9eymh/6kppWsdkgIUv17LB9dq7N5hoBKK18+mFAkEN0/ 2l9NmJBG6gx00KsTqzOaLk9v521t248vqFd0t3JLCBxAoPEp1uAW2uuSVT+plDO6D2QW/XPMq YCPLgpENmXtjsQyuO3qHsmEj7ADuvWnciELDZwwHy5jUnVx6XJLGFTxavbaOoYhmAJLWLNx4K wDto51GQG9Xf9Su3Zbz8tEoSemOuGOKh+7vNSe28t8XFuUbZT7RejSCpPnFVCi6vnCvaQnxQi /k/7LOKk+ieEKiObUWJaw4+/m8MrqxmI1kDLiZOoxsOhNrCbR37ehBhTXgcV9wDzfLTpQVAbj dK7g76Z62wZPt3F3LYbzBFuNHxKO4uIiSpY2VEKRZKz5GcwQA+ccoqjojblZot/0XTsitqHjz EIGbd9r5jhqfqNLSlq9ZaOMvdjdIVI5jmt526z9z+4cp0kUWphWkHhxWGQptRlRFl+Zo0n8tU OCvFrJeYiAic2Eeip8DDNxfKKoMyTmR8L2qSuOaEBjG9MEghxvosUP59llr36yRQLkeXR1ab1 +A5RhvIDnAneRiQWYIPHZIj+6F8hFa4G9W13gV35K2tkQH5sHzcxHOy+ixP0dCsx39+iMt2oQ oD/zG8RqEP8Wtb6dOYfnNhLnQqkR7VpAKhEPOAE3fVpI/ITWoMl0tt39vSGUEsWU1/eBnD6Fu tBSwLGgYG/VLwpitBIYRYTUJiAq7WzuQOEqk2Jp9ShWKLUhba8KhDQ70sKE= Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's better to restore ctime as well in the case of restoring old mode in ceph_set_acl(). Signed-off-by: Chengguang Xu --- fs/ceph/acl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index eb9d567c9ef8..9fc51d882065 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -101,6 +101,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) const char *name = NULL; char *value = NULL; struct iattr newattrs; + struct timespec64 old_ctime = inode->i_ctime; umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; switch (type) { @@ -154,6 +155,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) ret = __ceph_setxattr(inode, name, value, size, 0); if (ret) { if (new_mode != old_mode) { + newattrs.ia_ctime = old_ctime; newattrs.ia_mode = old_mode; newattrs.ia_valid = ATTR_MODE; __ceph_setattr(inode, &newattrs);