diff mbox

ceph: restore ctime as well in the case of restoring old mode

Message ID 20180622062237.31552-1-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu June 22, 2018, 6:22 a.m. UTC
It's better to restore ctime as well in the case of restoring old mode
in ceph_set_acl().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/ceph/acl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Yan, Zheng June 22, 2018, 6:48 a.m. UTC | #1
On Fri, Jun 22, 2018 at 2:25 PM Chengguang Xu <cgxu519@gmx.com> wrote:
>
> It's better to restore ctime as well in the case of restoring old mode
> in ceph_set_acl().
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  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;

newattrs.ia_valid = ATTR_MODE | ATTR_CTIME


>                         __ceph_setattr(inode, &newattrs);
> --
> 2.17.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);