From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Sandeen Subject: Re: [RFC 3/9] fsfreeze: Prevent emergency thaw from looping infinitely Date: Thu, 13 Sep 2012 11:40:09 -0500 Message-ID: <50520C69.1050805@redhat.com> References: <1347533862.5646.2.camel@nexus.lab.ntt.co.jp> <1347534188.5646.8.camel@nexus.lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , Josef Bacik , Dave Chinner , Christoph Hellwig , Jan Kara , linux-fsdevel@vger.kernel.org To: =?UTF-8?B?RmVybmFuZG8gTHVpcyBWw6F6cXVleiBDYW8=?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60699 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758532Ab2IMQkY (ORCPT ); Thu, 13 Sep 2012 12:40:24 -0400 In-Reply-To: <1347534188.5646.8.camel@nexus.lab.ntt.co.jp> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 9/13/12 6:03 AM, Fernando Luis V=C3=A1zquez Cao wrote: > The thawing of a filesystem through sysrq-j loops infinitely as it > incorrectly detects a thawed filesytsem as frozen and tries to > unfreeze repeatedly. This is a regression caused by > 4504230a71566785a05d3e6b53fa1ee071b864eb ("freeze_bdev: grab active > reference to frozen superblocks") in that it no longer returned > -EINVAL for superblocks that were not frozen. >=20 > Return -EINVAL when the filesystem is already unfrozen to avoid this > problem. >=20 > Cc: Josef Bacik > Cc: Eric Sandeen > Cc: Christoph Hellwig > Reviewed-by: Jan Kara > Signed-off-by: Dave Chinner > Signed-off-by: Fernando Luis Vazquez Cao Reviewed-by: Eric Sandeen I actually sent a simpler (but less cleaned up) version of this 2 years= ago, I guess it got missed and I didn't notice. So thanks! -Eric > --- >=20 > diff -urNp vfs-orig/fs/block_dev.c vfs/fs/block_dev.c > --- vfs-orig/fs/block_dev.c 2012-07-04 18:57:54.000000000 +0900 > +++ vfs/fs/block_dev.c 2012-07-12 13:22:38.124815295 +0900 > @@ -319,22 +319,17 @@ int thaw_bdev(struct block_device *bdev, > if (!bdev->bd_fsfreeze_count) > goto out; > =20 > - error =3D 0; > - if (--bdev->bd_fsfreeze_count > 0) > - goto out; > - > - if (!sb) > + if (--bdev->bd_fsfreeze_count > 0 || !sb) { > + error =3D 0; > goto out; > + } > =20 > error =3D 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); > =20 >=20 >=20 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html