[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP4dvseQoAohAZniZysw+gR=EGjMrKyyAOQ69-1FD7BOKS4VOQ@mail.gmail.com>
Date: Mon, 18 Nov 2024 18:14:51 +0800
From: Zhang Tianci <zhangtianci.1997@...edance.com>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
xieyongji@...edance.com, Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
Subject: Re: [External] Re: [PATCH] fuse: check attributes staleness on fuse_iget()
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
Powered by blists - more mailing lists