diff mbox series

[-next,v3,3/5] ext4: get buffer head before read_mmp_block

Message ID 20211019064959.625557-4-yebin10@huawei.com
State New
Headers show
Series Fix some issues about mmp | expand

Commit Message

yebin (H) Oct. 19, 2021, 6:49 a.m. UTC
There is only pass NULL 'bh' in ext4_multi_mount_protect,
So just call sb_getblk get buffer head fisrt, and we will
simplify read_mmp_block function.

Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 fs/ext4/mmp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jan Kara Oct. 19, 2021, 9:12 a.m. UTC | #1
On Tue 19-10-21 14:49:57, Ye Bin wrote:
> There is only pass NULL 'bh' in ext4_multi_mount_protect,
> So just call sb_getblk get buffer head fisrt, and we will
> simplify read_mmp_block function.
> 
> Signed-off-by: Ye Bin <yebin10@huawei.com>

I don't think there's a need to separate this into a special patch. Just
fold this change into patch 4. With that feel free to add:

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

The combined change looks good to me.

								Honza

> ---
>  fs/ext4/mmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
> index 4af8b99ade84..6ac6aacd8fa5 100644
> --- a/fs/ext4/mmp.c
> +++ b/fs/ext4/mmp.c
> @@ -295,6 +295,10 @@ int ext4_multi_mount_protect(struct super_block *sb,
>  		goto failed;
>  	}
>  
> +	bh = sb_getblk(sb, mmp_block);
> +	if (bh)
> +		goto failed;
> +
>  	retval = read_mmp_block(sb, &bh, mmp_block);
>  	if (retval)
>  		goto failed;
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 4af8b99ade84..6ac6aacd8fa5 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -295,6 +295,10 @@  int ext4_multi_mount_protect(struct super_block *sb,
 		goto failed;
 	}
 
+	bh = sb_getblk(sb, mmp_block);
+	if (bh)
+		goto failed;
+
 	retval = read_mmp_block(sb, &bh, mmp_block);
 	if (retval)
 		goto failed;