diff mbox series

[v2,03/10] bdev: surface the error from sync_blockdev()

Message ID 20231024-vfs-super-freeze-v2-3-599c19f4faac@kernel.org (mailing list archive)
State New, archived
Headers show
Series Implement freeze and thaw as holder operations | expand

Commit Message

Christian Brauner Oct. 24, 2023, 1:01 p.m. UTC
When freeze_super() is called, sync_filesystem() will be called which
calls sync_blockdev() and already surfaces any errors. Do the same for
block devices that aren't owned by a superblock and also for filesystems
that don't call sync_blockdev() internally but implicitly rely on
bdev_freeze() to do it.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 block/bdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong Oct. 24, 2023, 3:14 p.m. UTC | #1
On Tue, Oct 24, 2023 at 03:01:09PM +0200, Christian Brauner wrote:
> When freeze_super() is called, sync_filesystem() will be called which
> calls sync_blockdev() and already surfaces any errors. Do the same for
> block devices that aren't owned by a superblock and also for filesystems
> that don't call sync_blockdev() internally but implicitly rely on
> bdev_freeze() to do it.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>

Yessss less EIO munching in the VFS layer!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  block/bdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/bdev.c b/block/bdev.c
> index d674ad381c52..a3e2af580a73 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -245,7 +245,7 @@ int bdev_freeze(struct block_device *bdev)
>  	bdev->bd_fsfreeze_sb = sb;
>  
>  sync:
> -	sync_blockdev(bdev);
> +	error = sync_blockdev(bdev);
>  done:
>  	mutex_unlock(&bdev->bd_fsfreeze_mutex);
>  	return error;
> 
> -- 
> 2.34.1
>
Jan Kara Oct. 25, 2023, 12:36 p.m. UTC | #2
On Tue 24-10-23 15:01:09, Christian Brauner wrote:
> When freeze_super() is called, sync_filesystem() will be called which
> calls sync_blockdev() and already surfaces any errors. Do the same for
> block devices that aren't owned by a superblock and also for filesystems
> that don't call sync_blockdev() internally but implicitly rely on
> bdev_freeze() to do it.
> 
> Signed-off-by: Christian Brauner <brauner@kernel.org>

Looks good. Feel free to add:

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

> ---
>  block/bdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/bdev.c b/block/bdev.c
> index d674ad381c52..a3e2af580a73 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -245,7 +245,7 @@ int bdev_freeze(struct block_device *bdev)
>  	bdev->bd_fsfreeze_sb = sb;
>  
>  sync:
> -	sync_blockdev(bdev);
> +	error = sync_blockdev(bdev);
>  done:
>  	mutex_unlock(&bdev->bd_fsfreeze_mutex);
>  	return error;
> 
> -- 
> 2.34.1
>
Christoph Hellwig Oct. 27, 2023, 6:25 a.m. UTC | #3
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/block/bdev.c b/block/bdev.c
index d674ad381c52..a3e2af580a73 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -245,7 +245,7 @@  int bdev_freeze(struct block_device *bdev)
 	bdev->bd_fsfreeze_sb = sb;
 
 sync:
-	sync_blockdev(bdev);
+	error = sync_blockdev(bdev);
 done:
 	mutex_unlock(&bdev->bd_fsfreeze_mutex);
 	return error;