linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] super: allow waiting without s_umount held
@ 2023-08-18 14:00 Christian Brauner
  2023-08-18 14:00 ` [PATCH v3 1/4] super: use locking helpers Christian Brauner
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Christian Brauner @ 2023-08-18 14:00 UTC (permalink / raw)
  To: Jan Kara, Christoph Hellwig; +Cc: Al Viro, linux-fsdevel, Christian Brauner

Hey everyone,

This is an attempty to allow concurrent mounters and iterators to wait
on superblock state changes without having to hold s_umount. This is
made necessary by recent attempts to open block devices after superblock
creation and fixing deadlocks due to blkdev_put() trying to acquire
s_umount while s_umount is already held.

This is on top of Jan's and Christoph's work in vfs.super. Obviously not
for v6.6. I hope I got it right but this is intricate. 

It reliably survives xfstests for btrfs, ext4, and xfs while
concurrently having 7 processes running ustat() hammering on
super_blocks and a while true loop that tries to mount a filsystem with
an invalid superblock hammering on sget{_fc}() concurrently as well.
Even with inserting an arbitrary 5s delay after generic_shutdown_super()
and blkdev_put() things work fine.

Thanks and don't hit me over the head with things.
Christian

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Changes in v3:
- Improve super_lock() description.
- Use full barrier in super_wake() to ensure that waitqueue_active()
  check works as expected.
- Simplify grab_super_dead().
- Link to v2: https://lore.kernel.org/r/20230818-vfs-super-fixes-v3-v2-0-cdab45934983@kernel.org

Changes in v2:
- Rename various functions according to Jan's and Willy's suggestions.
- Remove smp_wmb() as smp_store_release() is enough.
- Remove hlist_unhashed() checks now that we wait on SB_DYING.
- Link to v1: https://lore.kernel.org/r/20230817-vfs-super-fixes-v3-v1-0-06ddeca7059b@kernel.org

---
Christian Brauner (4):
      super: use locking helpers
      super: make locking naming consistent
      super: wait for nascent superblocks
      super: wait until we passed kill super

 fs/fs-writeback.c  |   4 +-
 fs/internal.h      |   2 +-
 fs/super.c         | 377 +++++++++++++++++++++++++++++++++++++++--------------
 include/linux/fs.h |   2 +
 4 files changed, 286 insertions(+), 99 deletions(-)
---
base-commit: f3aeab61fb15edef1e81828da8dbf0814541e49b
change-id: 20230816-vfs-super-fixes-v3-f2cff6192a50


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

end of thread, other threads:[~2023-08-22 12:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18 14:00 [PATCH v3 0/4] super: allow waiting without s_umount held Christian Brauner
2023-08-18 14:00 ` [PATCH v3 1/4] super: use locking helpers Christian Brauner
2023-08-18 14:00 ` [PATCH v3 2/4] super: make locking naming consistent Christian Brauner
2023-08-18 14:00 ` [PATCH v3 3/4] super: wait for nascent superblocks Christian Brauner
2023-08-18 14:57   ` Matthew Wilcox
2023-08-18 15:21     ` Christian Brauner
2023-08-21 15:52   ` Jan Kara
2023-08-21 15:56     ` Christian Brauner
2023-08-21 16:04       ` Jan Kara
2023-08-21 16:02     ` Jan Kara
2023-08-21 16:08       ` Christian Brauner
2023-08-18 14:00 ` [PATCH v3 4/4] super: wait until we passed kill super Christian Brauner
2023-08-21 15:57   ` Jan Kara
2023-08-22 12:36 ` [PATCH v3 0/4] super: allow waiting without s_umount held Christian Brauner

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