linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Haifeng Xu <haifeng.xu@shopee.com>,
	Jeff Layton <jlayton@kernel.org>, Theodore Tso <tytso@mit.edu>,
	miklos@szeredi.hu, linux-unionfs@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Ext4 <linux-ext4@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>
Subject: Re: [PATCH v2] ovl: don't set the superblock's errseq_t manually
Date: Fri, 30 Aug 2024 08:26:48 -0700	[thread overview]
Message-ID: <20240830152648.GE6216@frogsfrogsfrogs> (raw)
In-Reply-To: <CAOQ4uxhs==_-EM+VyJRRCX_NPmYybPDBW2v7cXz33Qt2RMaPnQ@mail.gmail.com>

On Fri, Aug 30, 2024 at 03:27:35PM +0200, Amir Goldstein wrote:
> On Tue, Jul 30, 2024 at 6:20 AM Haifeng Xu <haifeng.xu@shopee.com> wrote:
> >
> > 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.
> >
> > Depends-on: commit 5679897eb104 ("vfs: make sync_filesystem return errors from ->sync_fs")
> > Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> > Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> > ---
> > Changes since v1:
> > - Add Depends-on and Reviewed-by tags.
> > ---
> >  fs/overlayfs/super.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> >
> > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> > index 06a231970cb5..fe511192f83c 100644
> > --- a/fs/overlayfs/super.c
> > +++ b/fs/overlayfs/super.c
> > @@ -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
> >
> 
> 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?

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

> Thanks,
> Amir.
> 

  reply	other threads:[~2024-08-30 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOQ4uxi4B8JHYHF=yn6OrRZCdkoPUj3-+PuZTZy6iJR7RNWcbA@mail.gmail.com>
     [not found] ` <20240730042008.395716-1-haifeng.xu@shopee.com>
2024-08-30 13:27   ` [PATCH v2] ovl: don't set the superblock's errseq_t manually Amir Goldstein
2024-08-30 15:26     ` Darrick J. Wong [this message]
2024-09-02 11:32       ` Haifeng Xu

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=20240830152648.GE6216@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=haifeng.xu@shopee.com \
    --cc=jlayton@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).