Re: [External] Re: [PATCH] fuse: check attributes staleness on fuse_iget()

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

 



Hi Miklos,

Thanks for your incremental patch, I test it and find one little problem:

> @@ -207,7 +214,8 @@ static ino_t fuse_squash_ino(u64 ino64)
>
>  void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
>                                    struct fuse_statx *sx,
> -                                  u64 attr_valid, u32 cache_mask)
> +                                  u64 attr_valid, u32 cache_mask,
> +                                  u64 evict_ctr)
>  {
>         struct fuse_conn *fc = get_fuse_conn(inode);
>         struct fuse_inode *fi = get_fuse_inode(inode);
> @@ -216,8 +224,20 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
>
>         fi->attr_version = atomic64_inc_return(&fc->attr_version);

Here we initialize fi->attr_version.

>         fi->i_time = attr_valid;
> -       /* Clear basic stats from invalid mask */
> -       set_mask_bits(&fi->inval_mask, STATX_BASIC_STATS, 0);
> +
> +       /*
> +        * Clear basic stats from invalid mask.
> +        *
> +        * Don't do this if this is coming from a fuse_iget() call and there
> +        * might have been a racing evict which would've invalidated the result
> +        * if the attr_version would've been preserved.
> +        *
> +        * !evict_ctr -> this is create
> +        * fi->attr_version != 0 -> this is not a new inode
> +        * evict_ctr == fuse_get_evict_ctr() -> no evicts while during request
> +        */
> +       if (!evict_ctr || fi->attr_version || evict_ctr == fuse_get_evict_ctr(fc))
> +               set_mask_bits(&fi->inval_mask, STATX_BASIC_STATS, 0);

This check should be moved to before the initialization of fi->attr_version.

>
>         inode->i_ino     = fuse_squash_ino(attr->ino);
>         inode->i_mode    = (inode->i_mode & S_IFMT) | (attr->mode & 07777);

And I will send out the v2 patch later.

Thanks,
Tianci




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux