linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] fuse: fuse_flush must check mapping->flags for errors
@ 2016-07-20  1:12 Maxim Patlasov
  2016-07-21 10:28 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Patlasov @ 2016-07-20  1:12 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, fuse-devel, devel, linux-kernel, kuznet

fuse_flush() calls write_inode_now() that triggers writeback, but actual
writeback will happen later, on fuse_sync_writes(). If an error happens,
fuse_writepage_end() will set error bit in mapping->flags. So, we have to
check mapping->flags after fuse_sync_writes().

Changed in v2:
 - fixed silly type: check must be *after* fuse_sync_writes()

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/file.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index ad1da83..6cac3dc 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id)
 	fuse_sync_writes(inode);
 	inode_unlock(inode);
 
+	if (test_bit(AS_ENOSPC, &file->f_mapping->flags) &&
+	    test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags))
+		err = -ENOSPC;
+	if (test_bit(AS_EIO, &file->f_mapping->flags) &&
+	    test_and_clear_bit(AS_EIO, &file->f_mapping->flags))
+		err = -EIO;
+	if (err)
+		return err;
+
 	req = fuse_get_req_nofail_nopages(fc, file);
 	memset(&inarg, 0, sizeof(inarg));
 	inarg.fh = ff->fh;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] fuse: fuse_flush must check mapping->flags for errors
  2016-07-20  1:12 [PATCH v2] fuse: fuse_flush must check mapping->flags for errors Maxim Patlasov
@ 2016-07-21 10:28 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2016-07-21 10:28 UTC (permalink / raw)
  To: Maxim Patlasov; +Cc: linux-fsdevel, fuse-devel, devel, linux-kernel, kuznet

On Wed, Jul 20, 2016 at 3:12 AM, Maxim Patlasov <mpatlasov@virtuozzo.com> wrote:
> fuse_flush() calls write_inode_now() that triggers writeback, but actual
> writeback will happen later, on fuse_sync_writes(). If an error happens,
> fuse_writepage_end() will set error bit in mapping->flags. So, we have to
> check mapping->flags after fuse_sync_writes().
>
> Changed in v2:
>  - fixed silly type: check must be *after* fuse_sync_writes()

I applied both with a cleanup patch at the end to use the
filemap_check_errors() helper, which does exactly this.

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-21 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-20  1:12 [PATCH v2] fuse: fuse_flush must check mapping->flags for errors Maxim Patlasov
2016-07-21 10:28 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).