ovl: don't set the superblock's errseq_t manually
Subsystems (2)
PATCH 1/1 ovl: don't set the superblock's errseq_t manually
Since commit 5679897eb104 ("vfs: make sync_filesystem return errors from ->sync_fs"), the return value from sync_fs callback can be seen in sync_filesystem(). Thus the errseq_set opreation can be removed here.
--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
fs/overlayfs/super.c +2 -8
@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret;
Signature · 1 line
2.25.1
Quoted 6 lines · Haifeng Xu
Since commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs"), the return value fromsync_fscallback can be seen insync_filesystem(). Thus theerrseq_setopreation can be removed here.Signed-off-by Haifeng Xu <[email protected]>
I would add either Fixes: or Depends-on: to prevent accidental backporting without the dependency.
Otherwise you may add:
Thanks,
Amir.
Quoted 29 lines
--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)fs/overlayfs/super.c +2
-9@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret; --2.25.1
Quoted 10 lines · Amir Goldstein
Quoted 6 lines · Haifeng Xu
Since commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs"), the return value fromsync_fscallback can be seen insync_filesystem(). Thus theerrseq_setopreation can be removed here.Signed-off-by Haifeng Xu <[email protected]>I would add either Fixes: or Depends-on: to prevent accidental backporting without the dependency.
OK, I'll add this in next version. Thanks!
Quoted 36 lines
Otherwise you may add:
Reviewed-by Amir Goldstein <[email protected]>Thanks,
Amir.Quoted 29 lines
--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)fs/overlayfs/super.c +2
-9@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret; --2.25.1
PATCH v2 1/1 ovl: don't set the superblock's errseq_t manually
In reply to Amir GoldsteinSince commit 5679897eb104 ("vfs: make sync_filesystem return errors from ->sync_fs"), the return value from sync_fs callback can be seen in sync_filesystem(). Thus the errseq_set opreation can be removed here.
Depends-on: commit 5679897eb104 ("vfs: make sync_filesystem return errors from ->sync_fs")
---
Changes since v1:
- Add Depends-on and Reviewed-by tags.
--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
fs/overlayfs/super.c +2 -8
@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret;
Signature · 1 line
2.25.1
Amir Goldstein
maintainerQuoted 38 lines · Haifeng Xu
Since commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs"), the return value fromsync_fscallback can be seen insync_filesystem(). Thus theerrseq_setopreation can be removed here.Depends-on: commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs")Signed-off-by Haifeng Xu <[email protected]>Reviewed-by Amir Goldstein <[email protected]>---
Changes since v1:
- Add Depends-on and Reviewed-by tags.--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)fs/overlayfs/super.c +2
-9@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret; --
Quoted 2 lines
2.25.1
FYI, this change is queued in overlayfs-next.
However, I went to see if overlayfs has test coverage for this and it does not.
The test coverage added by Darrick to the mentioned vfs commit is test xfs/546, so it does not run on other fs, although it is quite generic.
I fixed this test so it could run on overlayfs (like this):
# This command is complicated a bit because in the case of overlayfs the
# syncfs fd needs to be opened before shutdown and it is different from the
# shutdown fd, so we cannot use the _scratch_shutdown() helper.
# Filter out xfs_io output of active fds.
$XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f
' -c close -c syncfs $SCRATCH_MNT | \
grep -vF '[00'and it passes on both xfs and overlayfs (over xfs), but if I try to make it "generic"
it fails on ext4, which explicitly allows syncfs after shutdown:
if (unlikely(ext4_forced_shutdown(sb)))
return 0;Ted, Darrick,
Do you have any insight as to why this ext4 behavior differs from xfs or another idea how to exercise the syncfs error in a generic test?
I could fork an overlay/* test from the xfs/* test and require that underlying fs is xfs, but that would be ugly.
Any ideas?
Thanks,
Amir.
Quoted 67 lines · Amir Goldstein
Quoted 38 lines · Haifeng Xu
Since commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs"), the return value fromsync_fscallback can be seen insync_filesystem(). Thus theerrseq_setopreation can be removed here.Depends-on: commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs")Signed-off-by Haifeng Xu <[email protected]>Reviewed-by Amir Goldstein <[email protected]>---
Changes since v1:
- Add Depends-on and Reviewed-by tags.--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)fs/overlayfs/super.c +2
-9@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret; --Quoted 2 lines
2.25.1
FYI, this change is queued in overlayfs-next.
However, I went to see if overlayfs has test coverage for this and it does not.
The test coverage added by Darrick to the mentioned vfs commit is test xfs/546, so it does not run on other fs, although it is quite generic.
I fixed this test so it could run on overlayfs (like this):
# This command is complicated a bit because in the case of overlayfs the# syncfs fd needs to be opened before shutdown and it is different from the # shutdown fd, so we cannot use the _scratch_shutdown() helper. # Filter out xfs_io output of active fds. $XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f ' -c close -c syncfs $SCRATCH_MNT | \ grep -vF '[00'and it passes on both xfs and overlayfs (over xfs), but if I try to make it "generic"
it fails on ext4, which explicitly allows syncfs after shutdown:if (unlikely(ext4_forced_shutdown(sb))) return 0;Ted, Darrick,
Quoted 7 lines
Do you have any insight as to why this ext4 behavior differs from xfs or another idea how to exercise the syncfs error in a generic test?
I could fork an overlay/* test from the xfs/* test and require that underlying fs is xfs, but that would be ugly.
Any ideas?
That should be:
if (unlikely(ext4_forced_shutdown(sb))) return -EIO;
no? The fs is dead and cannot persist anything, so we should fling that back to the calling program.
--D
Quoted 3 lines
Thanks,
Amir.
Quoted 76 lines · Darrick J. Wong
Quoted 67 lines · Amir Goldstein
Quoted 38 lines · Haifeng Xu
Since commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs"), the return value fromsync_fscallback can be seen insync_filesystem(). Thus theerrseq_setopreation can be removed here.Depends-on: commit
5679897eb104("vfs: makesync_filesystemreturn errors from ->sync_fs")Signed-off-by Haifeng Xu <[email protected]>Reviewed-by Amir Goldstein <[email protected]>---
Changes since v1:
- Add Depends-on and Reviewed-by tags.--- fs/overlayfs/super.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)fs/overlayfs/super.c +2
-9@@ -202,15 +202,9 @@ static int ovl_sync_fs(struct super_block *sb, int wait)int ret; ret =ovl_sync_status (ofs); -/* -* We have to always set the err, because the return value isn't -* checked in syncfs, and instead indirectly return an error via -* the sb's writeback errseq, which VFS inspects after this call. -*/ -if (ret <0 ) { -errseq_set (&sb->s_wb_err, -EIO ); + +if (ret <0 )return -EIO ; - }if (!ret)return ret; --Quoted 2 lines
2.25.1
FYI, this change is queued in overlayfs-next.
However, I went to see if overlayfs has test coverage for this and it does not.
The test coverage added by Darrick to the mentioned vfs commit is test xfs/546, so it does not run on other fs, although it is quite generic.
I fixed this test so it could run on overlayfs (like this):
# This command is complicated a bit because in the case of overlayfs the# syncfs fd needs to be opened before shutdown and it is different from the # shutdown fd, so we cannot use the _scratch_shutdown() helper. # Filter out xfs_io output of active fds. $XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f ' -c close -c syncfs $SCRATCH_MNT | \ grep -vF '[00'and it passes on both xfs and overlayfs (over xfs), but if I try to make it "generic"
it fails on ext4, which explicitly allows syncfs after shutdown:if (unlikely(ext4_forced_shutdown(sb))) return 0;Ted, Darrick,
Quoted 7 lines
Do you have any insight as to why this ext4 behavior differs from xfs or another idea how to exercise the syncfs error in a generic test?
I could fork an overlay/* test from the xfs/* test and require that underlying fs is xfs, but that would be ugly.
Any ideas?
Quoted 7 lines
That should be:
if (unlikely(ext4_forced_shutdown(sb))) return -EIO;no? The fs is dead and cannot persist anything, so we should fling that back to the calling program.
yes. sync_filesystem() write outs and wait upon all dirty data. If the superblock is shutdown, writeback can't make any progress and there is no guarantees are made on how many dirty data have been written out. So I think it's reasonable to tell users about this error.
Quoted 6 lines
--D
Quoted 3 lines
Thanks,
Amir.