summaryrefslogtreecommitdiff
path: root/fs/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-08-11 12:08:25 +0200
committerChristian Brauner <brauner@kernel.org>2023-08-21 14:35:32 +0200
commitd8530de5a6e82be0ce17a5fdf727a394bcf6444c (patch)
treeb790d6a5ded81d976079576f1c777a59064342bc /fs/super.c
parent560e20e4bf6484a0c12f9f3c7a1aa55056948e1e (diff)
block: call into the file system for bdev_mark_dead
Combine the newly merged bdev_mark_dead helper with the existing mark_dead holder operation so that all operations that invalidate a device that is dead or being removed now go through the holder ops. This allows file systems to explicitly shutdown either ASAP (for a surprise removal) or after writing back data (for an orderly removal), and do so not only for the main device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Message-Id: <20230811100828.1897174-15-hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/super.c b/fs/super.c
index 9b2188e08bcc..11fa21da130c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1228,7 +1228,7 @@ static bool lock_active_super(struct super_block *sb)
return true;
}
-static void fs_mark_dead(struct block_device *bdev)
+static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
{
struct super_block *sb = bdev->bd_holder;
@@ -1238,6 +1238,10 @@ static void fs_mark_dead(struct block_device *bdev)
if (!lock_active_super(sb))
return;
+ if (!surprise)
+ sync_filesystem(sb);
+ shrink_dcache_sb(sb);
+ invalidate_inodes(sb, true);
if (sb->s_op->shutdown)
sb->s_op->shutdown(sb);
@@ -1245,7 +1249,7 @@ static void fs_mark_dead(struct block_device *bdev)
}
const struct blk_holder_ops fs_holder_ops = {
- .mark_dead = fs_mark_dead,
+ .mark_dead = fs_bdev_mark_dead,
};
EXPORT_SYMBOL_GPL(fs_holder_ops);