From: Jan Kara Subject: Re: [PATCH 1/8] fsfreeze: Prevent emergency thaw from looping infinitely Date: Fri, 13 Jul 2012 14:59:24 +0200 Message-ID: <20120713125924.GD20361@quack.suse.cz> References: <1342083464.7033.6.camel@nexus.lab.ntt.co.jp> <1342083727.7033.8.camel@nexus.lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , Jan Kara , Dave Chinner , Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Fernando Luis =?iso-8859-1?Q?V=E1zquez?= Cao Return-path: Received: from cantor2.suse.de ([195.135.220.15]:48766 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161529Ab2GMM72 (ORCPT ); Fri, 13 Jul 2012 08:59:28 -0400 Content-Disposition: inline In-Reply-To: <1342083727.7033.8.camel@nexus.lab.ntt.co.jp> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu 12-07-12 18:02:07, Fernando Luis V=E1zquez 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: Christoph Hellwig > Cc: Jan Kara > Signed-off-by: Dave Chinner > Signed-off-by: Fernando Luis Vazquez Cao Looks good. You can add: Reviewed-by: Jan Kara Honza > --- >=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 --=20 Jan Kara SUSE Labs, CR -- 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