diff options
author | Christoph Hellwig <hch@lst.de> | 2023-08-11 12:08:26 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-08-21 14:35:32 +0200 |
commit | 2142b88c37a3e49fbca4a36b8674626917d9bf40 (patch) | |
tree | 29c2476d72b5c8fe1a6b8040bba770d81c3d9b71 /fs/super.c | |
parent | block: call into the file system for bdev_mark_dead (diff) | |
download | linux-2142b88c37a3e49fbca4a36b8674626917d9bf40.tar.xz linux-2142b88c37a3e49fbca4a36b8674626917d9bf40.zip |
block: call into the file system for ioctl BLKFLSBUF
BLKFLSBUF is a historic ioctl that is called on a file handle to a
block device and syncs either the file system mounted on that block
device if there is one, or otherwise the just the data on the block
device.
Replace the get_super based syncing with a holder operation to remove
the last usage of get_super, and to also support syncing the file system
if the block device is not the main block device stored in s_dev.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Message-Id: <20230811100828.1897174-16-hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/super.c b/fs/super.c index 11fa21da130c..1a369fa3f0a6 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1248,8 +1248,21 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise) up_read(&sb->s_umount); } +static void fs_bdev_sync(struct block_device *bdev) +{ + struct super_block *sb = bdev->bd_holder; + + lockdep_assert_held(&bdev->bd_holder_lock); + + if (!lock_active_super(sb)) + return; + sync_filesystem(sb); + up_read(&sb->s_umount); +} + const struct blk_holder_ops fs_holder_ops = { .mark_dead = fs_bdev_mark_dead, + .sync = fs_bdev_sync, }; EXPORT_SYMBOL_GPL(fs_holder_ops); |