fs/block_dev.c: always return error in thaw_bdev()
PATCH 1/1 fs/block_dev.c: always return error in thaw_bdev()
When triggering thaw-filesystems via magic sysrq, the system enters a loop in do_thaw_one(), as thaw_bdev() still returns success if bd_fsfreeze_count == 0. To fix this, let thaw_bdev() always return error (and simplify the code a bit at the same time).
--- fs/block_dev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/block_dev.c +2 -5
@@ -269,14 +269,11 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb) error = sb->s_op->thaw_super (sb); else error =thaw_super (sb); -if (error) { +if (error) bdev->bd_fsfreeze_count++; -mutex_unlock (&bdev->bd_fsfreeze_mutex); -return error; - } out:mutex_unlock (&bdev->bd_fsfreeze_mutex); -return 0 ; +return error; }EXPORT_SYMBOL (thaw_bdev);
Signature · 1 line
2.3.0
Quoted 23 lines · Pierre Morel
When triggering thaw-filesystems via magic sysrq, the system enters a loop in
do_thaw_one(), asthaw_bdev()still returns success ifbd_fsfreeze_count== 0. To fix this, letthaw_bdev()always return error (and simplify the code a bit at the same time).Reviewed-by Eric Farman <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Pierre Morel <[email protected]>--- fs/block_dev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/block_dev.c +1
-1@@ -269,14 +269,11 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb) error = sb->s_op->thaw_super (sb); else error =thaw_super (sb); -if (error) { +if (error) bdev->bd_fsfreeze_count++;
fs/block_dev.c int thaw_bdev(struct block_device *bdev, struct super_block *sb) · line 279
Quoted 10 lines
fs/block_dev.c +1
-4-mutex_unlock (&bdev->bd_fsfreeze_mutex); -return error; - } out:mutex_unlock (&bdev->bd_fsfreeze_mutex); -return 0 ; +return error; }EXPORT_SYMBOL (thaw_bdev);
Apparently this never got in.
The bug is still there, reproducible with mere:
echo j > /proc/sysrq-trigger
Signature · 1 line
Mateusz Guzik