From: Vivek Goyal <vgoyal@redhat.com>
To: wubo <11123156@vivo.com>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Wu Bo <bo.wu@vivo.com>
Subject: Re: [PATCH] fuse: force sync attr when inode is invalidated
Date: Thu, 23 Jun 2022 14:38:36 -0400 [thread overview]
Message-ID: <YrSzLNCSg/8fWZ1j@redhat.com> (raw)
In-Reply-To: <20220621125651.14954-1-11123156@vivo.com>
On Tue, Jun 21, 2022 at 08:56:51PM +0800, wubo wrote:
> From: Wu Bo <bo.wu@vivo.com>
>
> Now the fuse driver only trust it's local inode size when
> writeback_cache is enabled. Even the userspace server tell the driver
> the inode cache is invalidated, the size attrabute will not update. And
> will keep it's out-of-date size till the inode cache is dropped. This is
> not reasonable.
BTW, can you give more details about what's the use case. With
writeback_cache, writes can be cached in fuse and not sent to
file server immediately. And I think that's why fuse trusts
local i_size.
With writeback_cache enabled, I don't think file should be modified
externally (outside the fuse client).
So what's that use case where file size cached in fuse is out of
date. You probably should not use writeback_cache if you are
modifying files outside the fuse client.
Having said that I am not sure why FUSE_NOTIFY_INVAL_INODE was added to
begin with. If files are not supposed to be modifed outside the fuse
client, why are we dropping acls and invalidating attrs. If intent is
just to drop page cache, then it should have been just that nothing
else.
So up to some extent, FUSE_NOTIFY_INVAL_INODE is somewhat confusing. Would
have been good if there was some documentation for it.
Thanks
Vivek
>
> Signed-off-by: Wu Bo <bo.wu@vivo.com>
> ---
> fs/fuse/inode.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 8c0665c5dff8..a4e62c7f2b83 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -162,6 +162,11 @@ static ino_t fuse_squash_ino(u64 ino64)
> return ino;
> }
>
> +static bool fuse_force_sync(struct fuse_inode *fi)
> +{
> + return fi->i_time == 0;
> +}
> +
> void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
> u64 attr_valid, u32 cache_mask)
> {
> @@ -222,8 +227,10 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
> u32 fuse_get_cache_mask(struct inode *inode)
> {
> struct fuse_conn *fc = get_fuse_conn(inode);
> + struct fuse_inode *fi = get_fuse_inode(inode);
> + bool is_force_sync = fuse_force_sync(fi);
>
> - if (!fc->writeback_cache || !S_ISREG(inode->i_mode))
> + if (!fc->writeback_cache || !S_ISREG(inode->i_mode) || is_force_sync)
> return 0;
>
> return STATX_MTIME | STATX_CTIME | STATX_SIZE;
> @@ -437,6 +444,7 @@ int fuse_reverse_inval_inode(struct fuse_conn *fc, u64 nodeid,
> fi = get_fuse_inode(inode);
> spin_lock(&fi->lock);
> fi->attr_version = atomic64_inc_return(&fc->attr_version);
> + fi->i_time = 0;
> spin_unlock(&fi->lock);
>
> fuse_invalidate_attr(inode);
> --
> 2.35.1
>
next prev parent reply other threads:[~2022-06-23 19:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 12:56 wubo
2022-06-23 18:38 ` Vivek Goyal [this message]
2022-06-24 2:27 ` [External] " Jiachen Zhang
2022-06-24 6:24 ` Jiachen Zhang
2022-06-28 4:20 ` Wu Bo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YrSzLNCSg/8fWZ1j@redhat.com \
--to=vgoyal@redhat.com \
--cc=11123156@vivo.com \
--cc=bo.wu@vivo.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®