Skip to content

Commit 559428a

Browse files
YuKuai-huaweiAl Viro
authored andcommitted
ext4: remove block_device_ejected()
block_device_ejected() is added by commit bdfe0cb ("Revert "ext4: remove block_device_ejected"") in 2015. At that time 'bdi->wb' is destroyed synchronized from del_gendisk(), hence if ext4 is still mounted, and then mark_buffer_dirty() will reference destroyed 'wb'. However, such problem doesn't exist anymore: - commit d03f6cd ("block: Dynamically allocate and refcount backing_dev_info") switch bdi to use refcounting; - commit 13eec23 ("fs: Get proper reference for s_bdi"), will grab additional reference of bdi while mounting, so that 'bdi->wb' will not be destroyed until generic_shutdown_super(). Hence remove this dead function block_device_ejected(). Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent d18a867 commit 559428a

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

fs/ext4/super.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -492,22 +492,6 @@ static void ext4_maybe_update_superblock(struct super_block *sb)
492492
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
493493
}
494494

495-
/*
496-
* The del_gendisk() function uninitializes the disk-specific data
497-
* structures, including the bdi structure, without telling anyone
498-
* else. Once this happens, any attempt to call mark_buffer_dirty()
499-
* (for example, by ext4_commit_super), will cause a kernel OOPS.
500-
* This is a kludge to prevent these oops until we can put in a proper
501-
* hook in del_gendisk() to inform the VFS and file system layers.
502-
*/
503-
static int block_device_ejected(struct super_block *sb)
504-
{
505-
struct inode *bd_inode = sb->s_bdev->bd_inode;
506-
struct backing_dev_info *bdi = inode_to_bdi(bd_inode);
507-
508-
return bdi->dev == NULL;
509-
}
510-
511495
static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
512496
{
513497
struct super_block *sb = journal->j_private;
@@ -6172,8 +6156,6 @@ static int ext4_commit_super(struct super_block *sb)
61726156

61736157
if (!sbh)
61746158
return -EINVAL;
6175-
if (block_device_ejected(sb))
6176-
return -ENODEV;
61776159

61786160
ext4_update_super(sb);
61796161

0 commit comments

Comments
 (0)