vfs: function to prevent re-use of block-device-based superblocks
authorDaniil Lunev <dlunev@chromium.org>
Wed, 27 Jul 2022 06:44:24 +0000 (16:44 +1000)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 27 Jul 2022 09:30:30 +0000 (11:30 +0200)
commit04b9407197789c81fffac52921e703cb47967d6a
tree7a3cff2cee9ac275b7a3201a13f1c6d4c08e2a7a
parent73fb2c8b61783e2e8a87f91d141bf72a12404566
vfs: function to prevent re-use of block-device-based superblocks

The function is to be called from filesystem-specific code to mark a
superblock to be ignored by superblock test and thus never re-used.  The
function also unregisters bdi if the bdi is per-superblock to avoid
collision if a new superblock is created to represent the filesystem.
generic_shutdown_super() skips unregistering bdi for a retired superlock as
it assumes retire function has already done it.

This patch adds the functionality only for the block-device-based supers,
since the primary use case of the feature is to gracefully handle force
unmount of external devices, mounted with FUSE.  This can be further
extended to cover all superblocks, if the need arises.

Signed-off-by: Daniil Lunev <dlunev@chromium.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/super.c
include/linux/fs.h