Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753300AbcJDIxs (ORCPT ); Tue, 4 Oct 2016 04:53:48 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46649 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726AbcJDIxq (ORCPT ); Tue, 4 Oct 2016 04:53:46 -0400 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 X-Mailer: git-send-email 1.7.1 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> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16100408-0032-0000-0000-0000022102BC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16100408-0033-0000-0000-00001D23CC08 Message-Id: <1475571220-2522-2-git-send-email-pmorel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-04_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610040156 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1015 Lines: 35 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