Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39739 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751414AbcJDIxq (ORCPT ); Tue, 4 Oct 2016 04:53:46 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u948qWbh094547 for ; Tue, 4 Oct 2016 04:53:45 -0400 Received: from e06smtp08.uk.ibm.com (e06smtp08.uk.ibm.com [195.75.94.104]) by mx0a-001b2d01.pphosted.com with ESMTP id 25v935rgdj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 04 Oct 2016 04:53:45 -0400 Received: from localhost by e06smtp08.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Oct 2016 09:53:43 +0100 From: Pierre Morel To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, mguzik@redhat.com, farman@linux.vnet.ibm.com, cornelia.huck@de.ibm.com Subject: [PATCH] fs/block_dev.c: return the right error in thaw_bdev() Date: Tue, 4 Oct 2016 10:53:40 +0200 In-Reply-To: <1475571220-2522-1-git-send-email-pmorel@linux.vnet.ibm.com> References: <1475571220-2522-1-git-send-email-pmorel@linux.vnet.ibm.com> Message-Id: <1475571220-2522-2-git-send-email-pmorel@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 Reviewed-by: Cornelia Huck Signed-off-by: Pierre Morel --- 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 08ae993..0e7a8f4 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -302,14 +302,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.5.0