Re: [PATCH v2] ceph: restore ctime as well in the case of restoring old mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 22, 2018 at 3:03 PM Chengguang Xu <cgxu519@xxxxxxx> 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@xxxxxxx>
> ---
> 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;
> --

Applied, thanks

Yan, Zheng

> 2.17.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux