diff mbox series

[15/16] ext4: wire up sops->shutdown

Message ID 20230601094459.1350643-16-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/16] block: factor out a bd_end_claim helper from blkdev_put | expand

Commit Message

Christoph Hellwig June 1, 2023, 9:44 a.m. UTC
Wire up the shutdown method to shut down the file system when the
underlying block device is marked dead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/ext4/super.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jan Kara June 1, 2023, 10:10 a.m. UTC | #1
On Thu 01-06-23 11:44:58, Christoph Hellwig wrote:
> Wire up the shutdown method to shut down the file system when the
> underlying block device is marked dead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/super.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 865625089ecca3..a177a16c4d2fe5 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1450,6 +1450,11 @@ static void ext4_destroy_inode(struct inode *inode)
>  			 EXT4_I(inode)->i_reserved_data_blocks);
>  }
>  
> +static void ext4_shutdown(struct super_block *sb)
> +{
> +       ext4_force_shutdown(sb, EXT4_GOING_FLAGS_NOLOGFLUSH);
> +}
> +
>  static void init_once(void *foo)
>  {
>  	struct ext4_inode_info *ei = foo;
> @@ -1610,6 +1615,7 @@ static const struct super_operations ext4_sops = {
>  	.unfreeze_fs	= ext4_unfreeze,
>  	.statfs		= ext4_statfs,
>  	.show_options	= ext4_show_options,
> +	.shutdown	= ext4_shutdown,
>  #ifdef CONFIG_QUOTA
>  	.quota_read	= ext4_quota_read,
>  	.quota_write	= ext4_quota_write,
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 865625089ecca3..a177a16c4d2fe5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1450,6 +1450,11 @@  static void ext4_destroy_inode(struct inode *inode)
 			 EXT4_I(inode)->i_reserved_data_blocks);
 }
 
+static void ext4_shutdown(struct super_block *sb)
+{
+       ext4_force_shutdown(sb, EXT4_GOING_FLAGS_NOLOGFLUSH);
+}
+
 static void init_once(void *foo)
 {
 	struct ext4_inode_info *ei = foo;
@@ -1610,6 +1615,7 @@  static const struct super_operations ext4_sops = {
 	.unfreeze_fs	= ext4_unfreeze,
 	.statfs		= ext4_statfs,
 	.show_options	= ext4_show_options,
+	.shutdown	= ext4_shutdown,
 #ifdef CONFIG_QUOTA
 	.quota_read	= ext4_quota_read,
 	.quota_write	= ext4_quota_write,