aboutsummaryrefslogtreecommitdiff
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig2021-04-06 08:22:54 +0200
committerJens Axboe2021-04-08 10:24:36 -0600
commit473338be3aaea117a7133720305f240eb7f68951 (patch)
tree254b617fa5e8fb02fc8264df93ed77733af50d82 /block/partitions
parent45611837bb37e4544ca048e33d833483b06e3b03 (diff)
block: move more syncing and invalidation to delete_partition
Move the calls to fsync_bdev and __invalidate_device from del_gendisk to delete_partition. For the other two callers that check that there are no openers for the delete partitions(s) the callouts are a no-op as no file system can be mounted, but this keeps all the cleanup in one place. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210406062303.811835-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions')
-rw-r--r--block/partitions/core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 22a0dab17ed3..8c1735292940 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -287,6 +287,9 @@ struct device_type part_type = {
*/
void delete_partition(struct block_device *part)
{
+ fsync_bdev(part);
+ __invalidate_device(part, true);
+
xa_erase(&part->bd_disk->part_tbl, part->bd_partno);
kobject_put(part->bd_holder_dir);
device_del(&part->bd_device);
@@ -468,9 +471,6 @@ int bdev_del_partition(struct block_device *bdev, int partno)
if (part->bd_openers)
goto out_unlock;
- sync_blockdev(part);
- invalidate_bdev(part);
-
delete_partition(part);
ret = 0;
out_unlock: