From patchwork Fri Jun 22 07:01:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10481377 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 26CF360230 for ; Fri, 22 Jun 2018 07:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1751628387 for ; Fri, 22 Jun 2018 07:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BC5828E00; Fri, 22 Jun 2018 07:02:33 +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 9A24828387 for ; Fri, 22 Jun 2018 07:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751053AbeFVHCa (ORCPT ); Fri, 22 Jun 2018 03:02:30 -0400 Received: from mout.gmx.net ([212.227.17.21]:51199 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbeFVHC3 (ORCPT ); Fri, 22 Jun 2018 03:02:29 -0400 Received: from localhost.localdomain ([122.224.77.194]) by mail.gmx.com (mrgmx102 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MfjJY-1frCiB0Vee-00NCex; Fri, 22 Jun 2018 09:02:23 +0200 From: Chengguang Xu To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, idryomov@gmail.com, Chengguang Xu Subject: [PATCH v2] ceph: restore ctime as well in the case of restoring old mode Date: Fri, 22 Jun 2018 15:01:13 +0800 Message-Id: <20180622070113.10719-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:G0rzFkfpylUXYeXqujreYIfUPAbUkY23MfKUSrOVBv1OC/VKCHV 6WUw4DVkVSWozFVlwm03XWgt3QHqDfhpow3MZ7Omw4wqY2aqUkeD8e7PalIgFx+VKEmUKPA 9x8coLUZpWwNhioNJPeXyJVQQvHfADdOHVivMc160v0aHLNeqhh+DRW8sJsaWlemg5i09Nq sJyWrzdMJY0tQkttUYaOQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:QzHhrUl44VY=:vQoGN+7gaYAmCMJ2dNC/fe fOfrWICy8GWs6px74I8EYzd5d/gmQ5FSr1vmj+e9UGpM8ZzkzPBNW8ZGFUhdj3j7dJ22B6muh gAsTqjMNrlBfko0OoNUakPfKJKc+3Y5LYaeyBqCvB3VK9CXnBC8mwEo7uxxltRbW3UaljX/QP OgxXOd08QTeVC0hSfqHxFcSrnak4rzHHEBqylqkOkFTJcvSMaqczZYNKlbqQYJ8BOcZRksVEr TEsCtRPiDNtnOw1yM93+JJNKJgmqrf8d3t4zUs1T5YWuGl0q7Kw638jrc85dz8SOskti4mLnN cyILq1bQsnf4Uqyz95dNLWpM+bCXHvszj5c4wY125zuoWZOR/dDXI2Hkz+OeKbowdHQV2X1TT xpFVRT6NK/93A52GwKxxdjG4nv4r11bFGkjTlMCnlU1RieAG3m4vrgRaBKURmGgeg+FYpP+nb 2d/61S40pvuDAYCXDetBK7HbGwpmYn6uVQX6av6mLMckuC0GFpBoNS7bhACIXACikyfGZRAzt SKXl8th1w6193X74ICk2/z2/edfbL5G3NCCttoaPlhqDcO3tqxLFQ5V2dhdcgEG6HkhlRdx+Y YPNizWVYPIW9RMCzC3hh2GiYXLm4MgMgMCR4V66MYF811H+oeXf0gitAaDnz3zVHnE2m8Hxq8 xLCZ/ROpnK8BXsDyHzk+yucIA93AnYkdfpZBa1xBkj9uloN2ZCZpZQmJKJH1uFRA7G9VYHc+k 32Wf+xzxwZSi7Lm97alTmE/KGnfgYt0KGpm5uHJ5R8op3PSgvThdrVO1n5s= 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 --- v2: - Add flag 'ATTR_CTIME' to tell ctime has been changed. fs/ceph/acl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index eb9d567c9ef8..3351ea14390b 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) { @@ -145,7 +146,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) if (new_mode != old_mode) { newattrs.ia_ctime = current_time(inode); newattrs.ia_mode = new_mode; - newattrs.ia_valid = ATTR_MODE; + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; ret = __ceph_setattr(inode, &newattrs); if (ret) goto out_free; @@ -154,8 +155,9 @@ 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; + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; __ceph_setattr(inode, &newattrs); } goto out_free;