linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/block_dev.c: always return error in thaw_bdev()
@ 2015-08-20 10:07 Pierre Morel
  2016-10-03  4:13 ` Mateusz Guzik
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Morel @ 2015-08-20 10:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, linux-fsdevel, farman, cornelia.huck, pmorel

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).

Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
---
 fs/block_dev.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index c7e4163..7809c92 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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);
 
-- 
2.3.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/block_dev.c: always return error in thaw_bdev()
  2015-08-20 10:07 [PATCH] fs/block_dev.c: always return error in thaw_bdev() Pierre Morel
@ 2016-10-03  4:13 ` Mateusz Guzik
  0 siblings, 0 replies; 2+ messages in thread
From: Mateusz Guzik @ 2016-10-03  4:13 UTC (permalink / raw)
  To: Pierre Morel; +Cc: linux-kernel, viro, linux-fsdevel, farman, cornelia.huck

On Thu, Aug 20, 2015 at 12:07:49PM +0200, Pierre Morel wrote:
> 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).
> 
> Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
> ---
>  fs/block_dev.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index c7e4163..7809c92 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -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);
>  

Apparently this never got in.

The bug is still there, reproducible with mere:
echo j > /proc/sysrq-trigger

-- 
Mateusz Guzik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-03  4:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 10:07 [PATCH] fs/block_dev.c: always return error in thaw_bdev() Pierre Morel
2016-10-03  4:13 ` Mateusz Guzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).