diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-06-22 03:01:13 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-08-02 15:26:11 -0400 |
commit | 93d35c754d97a57bda2a2c6c39dce9b67a9f3c99 (patch) | |
tree | af4dad338fa9df711bf864b89f4c15abdf16d516 | |
parent | f017754d6919f3bd9786710b07b4708293594f20 (diff) |
ceph: restore ctime as well in the case of restoring old mode
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>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | fs/ceph/acl.c | 6 |
1 files 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) | |||
101 | const char *name = NULL; | 101 | const char *name = NULL; |
102 | char *value = NULL; | 102 | char *value = NULL; |
103 | struct iattr newattrs; | 103 | struct iattr newattrs; |
104 | struct timespec64 old_ctime = inode->i_ctime; | ||
104 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; | 105 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; |
105 | 106 | ||
106 | switch (type) { | 107 | switch (type) { |
@@ -145,7 +146,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
145 | if (new_mode != old_mode) { | 146 | if (new_mode != old_mode) { |
146 | newattrs.ia_ctime = current_time(inode); | 147 | newattrs.ia_ctime = current_time(inode); |
147 | newattrs.ia_mode = new_mode; | 148 | newattrs.ia_mode = new_mode; |
148 | newattrs.ia_valid = ATTR_MODE; | 149 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
149 | ret = __ceph_setattr(inode, &newattrs); | 150 | ret = __ceph_setattr(inode, &newattrs); |
150 | if (ret) | 151 | if (ret) |
151 | goto out_free; | 152 | goto out_free; |
@@ -154,8 +155,9 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
154 | ret = __ceph_setxattr(inode, name, value, size, 0); | 155 | ret = __ceph_setxattr(inode, name, value, size, 0); |
155 | if (ret) { | 156 | if (ret) { |
156 | if (new_mode != old_mode) { | 157 | if (new_mode != old_mode) { |
158 | newattrs.ia_ctime = old_ctime; | ||
157 | newattrs.ia_mode = old_mode; | 159 | newattrs.ia_mode = old_mode; |
158 | newattrs.ia_valid = ATTR_MODE; | 160 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
159 | __ceph_setattr(inode, &newattrs); | 161 | __ceph_setattr(inode, &newattrs); |
160 | } | 162 | } |
161 | goto out_free; | 163 | goto out_free; |