From: Miklos Szeredi <miklos@szeredi.hu>
To: Jeff Layton <jlayton@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
ChenXiaoSong <chenxiaosong2@huawei.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
liuyongqiang13@huawei.com, "zhangyi (F)" <yi.zhang@huawei.com>,
zhangxiaoxu5@huawei.com, Steve French <smfrench@gmail.com>,
NeilBrown <neilb@suse.de>
Subject: Re: [PATCH -next,v2] fuse: return the more nuanced writeback error on close()
Date: Mon, 30 May 2022 16:38:24 +0200 [thread overview]
Message-ID: <YpTW4LNGGzuXu/bq@miu.piliscsaba.redhat.com> (raw)
In-Reply-To: <9915b7b556106d2a525941141755adcca9e50163.camel@kernel.org>
On Mon, May 30, 2022 at 10:02:06AM -0400, Jeff Layton wrote:
> The main difference is that ->flush is called from filp_close, so it's
> called when a file descriptor (or equivalent) is being torn down out,
> whereas ->fsync is (obviously) called from the fsync codepath.
>
> We _must_ report writeback errors on fsync, but reporting them on the
> close() syscall is less clear. The thing about close() is that it's
> going be successful no matter what is returned. The file descriptor will
> no longer work afterward regardless.
>
> fsync also must also initiate writeback of all the buffered data, but
> it's not required for filesystems to do that on close() (and in fact,
> there are good reasons not to if you can). A successful close() tells
> you nothing about whether your data made it to the backing store. It
> might just not have been synced out yet.
>
> Personally, I think it's probably best to _not_ return writeback errors
> on close at all. The only "legitimate" error on close is -EBADF.
> Arguably, we should make ->flush be void return. Note that most
> filp_close callers ignore the error anyway, so it's not much of a
> stretch.
>
> In any case, if you do decide to return errors in fuse_flush, then
> advancing the cursor would also have the effect of masking writeback
> errors on dup()'ed file descriptors, and I don't think you want to do
> that.
Thanks for clarifying.
Chen, would the following patch make sense for your case?
Thanks,
Miklos
---
fs/fuse/file.c | 5 -----
1 file changed, 5 deletions(-)
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -487,11 +487,6 @@ static int fuse_flush(struct file *file,
fuse_sync_writes(inode);
inode_unlock(inode);
- err = filemap_check_errors(file->f_mapping);
- if (err)
- return err;
-
- err = 0;
if (fm->fc->no_flush)
goto inval_attr_out;
next prev parent reply other threads:[~2022-05-30 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 1:48 ChenXiaoSong
2022-05-30 12:13 ` Miklos Szeredi
2022-05-30 14:02 ` Jeff Layton
2022-05-30 14:38 ` Miklos Szeredi [this message]
2022-05-30 22:33 ` NeilBrown
2022-05-31 15:31 ` Trond Myklebust
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=YpTW4LNGGzuXu/bq@miu.piliscsaba.redhat.com \
--to=miklos@szeredi.hu \
--cc=chenxiaosong2@huawei.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=neilb@suse.de \
--cc=smfrench@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/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®