mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	 Josef Bacik <josef@toxicpanda.com>,
	linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 "Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH 0/5] super: rework super_lock()
Date: Fri, 23 Oct 2026 11:41:00 +0200	[thread overview]
Message-ID: <20261023-work-super-lock_helpers-v1-0-d0fcb3f2f275@kernel.org> (raw)

Josef's two series (cf. [1], [2]) left us with four ways to lock a
superblock and two ways to wait for one that's being shut down.
super_lock(), super_lock_shared() and super_lock_excl() return true on
success while super_lock_killable() returns 0. And callers that need an
unmount to be over pair super_lock() with super_wait_shutdown() or
super_wait_shutdown_killable() and have to pick the one that matches
the lock they took. Jan pointed out the bool vs int mess (cf. [3]).

So fold it all into a single super_lock() that takes SUPER_LOCK_EXCL,
SUPER_LOCK_KILLABLE and SUPER_LOCK_WAIT_SHUTDOWN and returns 0 with
s_umount held or a negative error code. The first three patches don't
change behavior.

The fourth patch makes sync(2) killable while it waits for s_umount of
a live superblock. Right now a freeze or remount that's stuck under
s_umount hangs every sync(2) on the machine and nobody can kill it.
fs_bdev_sync() already works that way.

The last patch adds a guard for super_lock() for the callers that take
and drop s_umount in the same scope.

This sits on top of vfs-7.5.super which carries Josef's series.

[1]: https://lore.kernel.org/20261021-b4-super-lock-dying-v1-0-2b35e86706ff@toxicpanda.com
[2]: https://lore.kernel.org/20261021-b4-super-lock-unborn-v1-0-0265eddb6dee@toxicpanda.com
[3]: https://lore.kernel.org/tmw22jj2hn6g6lklme2j3rsfjvmstzpoicvibvmmv6sivd66oj@nhc4lng25gti

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
Christian Brauner (5):
      super: add super_wait()
      super: let super_lock() take flags
      super: let super_lock() wait for a superblock being shut down
      super: make sync(2)'s wait for s_umount killable
      super: add a guard for super_lock()

 fs/super.c | 340 ++++++++++++++++++++++++++++---------------------------------
 1 file changed, 156 insertions(+), 184 deletions(-)
---
base-commit: e6d8f4efc8e2301e15de7bcf9e8d3a2134fb058a
change-id: 20261023-work-super-lock_helpers-23d8d257c1b4


             reply	other threads:[~2026-10-23  9:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  9:41 Christian Brauner [this message]
2026-10-23  9:41 ` [PATCH 1/5] super: add super_wait() Christian Brauner
2026-10-23  9:41 ` [PATCH 2/5] super: let super_lock() take flags Christian Brauner
2026-10-23  9:41 ` [PATCH 3/5] super: let super_lock() wait for a superblock being shut down Christian Brauner
2026-10-23  9:41 ` [PATCH 4/5] super: make sync(2)'s wait for s_umount killable Christian Brauner
2026-10-23  9:41 ` [PATCH 5/5] super: add a guard for super_lock() Christian Brauner
2026-10-23 13:54 ` [PATCH 0/5] super: rework super_lock() Josef Bacik

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=20261023-work-super-lock_helpers-v1-0-d0fcb3f2f275@kernel.org \
    --to=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®