From: Brian Foster <bfoster@redhat.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org
Subject: Re: [PATCH] bcachefs: remove sb lock and flags update on explicit shutdown
Date: Fri, 1 Dec 2023 08:43:52 -0500 [thread overview]
Message-ID: <ZWnjGOvxSLUfUos2@bfoster> (raw)
In-Reply-To: <20231201020006.4i5gztfj6m2lr264@moria.home.lan>
On Thu, Nov 30, 2023 at 09:00:06PM -0500, Kent Overstreet wrote:
> On Thu, Nov 30, 2023 at 02:17:11PM -0500, Brian Foster wrote:
> > bcachefs grabs s_umount and sets SB_RDONLY when the fs is shutdown
> > via the ioctl() interface. This has a couple issues related to
> > interactions between shutdown and freeze:
> >
> > 1. The flags == FSOP_GOING_FLAGS_DEFAULT case is a deadlock vector
> > because freeze_bdev() calls into freeze_super(), which also
> > acquires s_umount.
> >
> > 2. If an explicit shutdown occurs while the sb is frozen, SB_RDONLY
> > alters the thaw path as if the sb was read-only at freeze time.
> > This effectively leaks the frozen state and leaves the sb frozen
> > indefinitely.
> >
> > The usage of SB_RDONLY here goes back to the initial bcachefs commit
> > and AFAICT is simply historical behavior. This behavior is unique to
> > bcachefs relative to the handful of other filesystems that support
> > the shutdown ioctl(). Typically, SB_RDONLY is reserved for the
> > proper remount path, which itself is restricted from modifying
> > frozen superblocks in reconfigure_super(). Drop the unnecessary sb
> > lock and flags update bch2_ioc_goingdown() to address both of these
> > issues.
>
> Nice, I noticed a deadlock issue recently with s_umount here but didn't
> have time to fully debug it - applied!
>
Thanks!
Hmm.. got a reference to that observed deadlock handy? I'd be a little
cautious associating here because 1. I dont think any test tooling
currently uses the default shutdown mode for the ioctl and 2. the
non-ioctl emergency shutdown paths dont set SB_RDONLY, so shouldn't
trigger the freeze issue.
So IOW while this path was broken in the ways described in the commit
log, it still seems rather unlikely for a normal use or test case to
trigger this. It would be good to know if there's still a lingering
issue to resolve..
Brian
next prev parent reply other threads:[~2023-12-01 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 19:17 [PATCH] bcachefs: remove sb lock and flags update on explicit shutdown Brian Foster
2023-12-01 2:00 ` Kent Overstreet
2023-12-01 13:43 ` Brian Foster [this message]
2023-12-02 0:38 ` Kent Overstreet
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=ZWnjGOvxSLUfUos2@bfoster \
--to=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
/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