linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3][v3] vfs, overlayfs: Fix syncfs() to return correct errors
@ 2020-12-21 19:50 Vivek Goyal
  2020-12-21 19:50 ` [PATCH 1/3] vfs: Do not ignore return code from s_op->sync_fs Vivek Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Vivek Goyal @ 2020-12-21 19:50 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, linux-unionfs
  Cc: jlayton, vgoyal, amir73il, sargun, miklos, willy, jack, neilb, viro, hch

Hi,

This is v3 of patches which try to fix syncfs() error handling issues
w.r.t overlayfs and other filesystems.

Previous version of patches are here.
v2: 
https://lore.kernel.org/linux-fsdevel/20201216233149.39025-1-vgoyal@redhat.com/
v1:
https://lore.kernel.org/linux-fsdevel/20201216143802.GA10550@redhat.com/

This series basically is trying to fix two problems.

- First problem is that we ignore error code returned by ->sync_fs().
  overlayfs file system can return error and there are other file
  systems which can return error in certain cases. So to fix this issue,
  first patch captures the return code from ->sync_fs and returns to
  user space.

- Second problem is that current syncfs(), writeback error detection
  logic does not work for overlayfs. current logic relies on all
  sb->s_wb_err being update when errors occur but that's not true for
  overlayfs. Real errors happen on underlyig filessytem and overlayfs
  has no clue about these. To fix this issue, it has been proposed
  that for filesystems like overlayfs, this check should be moved into
  filesystem and then filesystem can check for error w.r.t upper super
  block.

  There seem to be multiple ways of how this can be done.

  A. Add a "struct file" argument to ->sync_fs() and modify all helpers.
  B. Add a separate file operation say "f_op->syncfs()" and call that
     in syncfs().
  C. Add a separate super block operation to check and advance errors.

Option A involves lot of changes all across the code. Also it is little
problematic in the sense that for filesystems having a block device,
looks like we want to check for errors after ___sync_blockdev() has
returned. But ->sync_fs() is called before that. That means
__sync_blockdev() will have to be pushed in side filesystem code as
well. Jeff Layton gave something like this a try here.

https://lore.kernel.org/linux-fsdevel/20180518123415.28181-1-jlayton@kernel.org/

I posted patches for option B in V2. 

https://lore.kernel.org/linux-fsdevel/20201216233149.39025-1-vgoyal@redhat.com/

Now this is V3 of patches which implements option C. I think this is
simplest in terms of implementation atleast.

These patches are only compile tested. Will do more testing once I get
a sense which option has a chance to fly.

I think patch 1 should be applied irrespective of what option we end
up choosing for fixing the writeback error issue.

Thanks
Vivek

Vivek Goyal (3):
  vfs: Do not ignore return code from s_op->sync_fs
  vfs: Add a super block operation to check for writeback errors
  overlayfs: Report writeback errors on upper

 fs/overlayfs/file.c      |  1 +
 fs/overlayfs/overlayfs.h |  1 +
 fs/overlayfs/readdir.c   |  1 +
 fs/overlayfs/super.c     | 23 +++++++++++++++++++++++
 fs/overlayfs/util.c      | 13 +++++++++++++
 fs/sync.c                | 13 ++++++++++---
 include/linux/fs.h       |  1 +
 7 files changed, 50 insertions(+), 3 deletions(-)

-- 
2.25.4


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

end of thread, other threads:[~2021-01-05 16:58 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 19:50 [RFC PATCH 0/3][v3] vfs, overlayfs: Fix syncfs() to return correct errors Vivek Goyal
2020-12-21 19:50 ` [PATCH 1/3] vfs: Do not ignore return code from s_op->sync_fs Vivek Goyal
2020-12-22  1:23   ` NeilBrown
2020-12-22 15:17     ` Vivek Goyal
2020-12-21 19:50 ` [PATCH 2/3] vfs: Add a super block operation to check for writeback errors Vivek Goyal
2020-12-22 16:19   ` Matthew Wilcox
2020-12-22 16:25     ` Vivek Goyal
2020-12-23 12:44       ` Jeff Layton
2020-12-23 12:48   ` Jeff Layton
2021-01-04 19:41     ` Vivek Goyal
2020-12-21 19:50 ` [PATCH 3/3] overlayfs: Report writeback errors on upper Vivek Goyal
2020-12-22 16:20   ` Matthew Wilcox
2020-12-22 16:29     ` Vivek Goyal
2020-12-22 17:46       ` Matthew Wilcox
2020-12-22 17:55         ` Vivek Goyal
2020-12-23 12:53           ` Jeff Layton
2020-12-23 18:20   ` Sargun Dhillon
2020-12-23 18:50     ` Matthew Wilcox
2020-12-23 19:29       ` Sargun Dhillon
2020-12-23 20:07         ` Matthew Wilcox
2020-12-23 20:21           ` Sargun Dhillon
2020-12-23 20:44             ` Matthew Wilcox
2020-12-24  9:32               ` Amir Goldstein
2020-12-24 10:12                 ` Sargun Dhillon
2020-12-24 12:13                 ` Matthew Wilcox
2020-12-25  6:50                   ` Amir Goldstein
2020-12-28 13:25                     ` Jeff Layton
2020-12-28 15:51                       ` Amir Goldstein
2021-01-04 15:51                         ` Vivek Goyal
2020-12-28 15:56                       ` Matthew Wilcox
2020-12-28 17:26                         ` Jeff Layton
2020-12-28 19:25                           ` Sargun Dhillon
2020-12-28 19:37                           ` Amir Goldstein
2020-12-28 20:48                             ` Matthew Wilcox
2021-01-02 13:25                               ` Jeff Layton
2021-01-04 16:59                         ` Vivek Goyal
2021-01-04 15:14                 ` Vivek Goyal
2021-01-04 15:22                   ` Amir Goldstein
2021-01-04 15:40                     ` Vivek Goyal
2021-01-04 21:42                       ` Amir Goldstein
2021-01-04 22:44                         ` Vivek Goyal
2021-01-05  7:11                           ` Amir Goldstein
2021-01-05 16:26                             ` Vivek Goyal
2021-01-05 16:57                               ` Amir Goldstein
2020-12-23 19:00     ` Jeff Layton
2021-01-04 20:00     ` Vivek Goyal

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).