From patchwork Wed Feb 28 11:17:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 10247295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03F6860211 for ; Wed, 28 Feb 2018 11:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E802828CC3 for ; Wed, 28 Feb 2018 11:20:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA38228CC4; Wed, 28 Feb 2018 11:20:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4110428C6D for ; Wed, 28 Feb 2018 11:20:26 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SBHC8s125016; Wed, 28 Feb 2018 11:18:18 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2gdqnk104y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2018 11:18:18 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1SBIGJ9022509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Feb 2018 11:18:16 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eqzkW-0000eO-Kz; Wed, 28 Feb 2018 03:18:16 -0800 Received: from aserv0021.oracle.com ([141.146.126.233]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eqzkU-0000dj-Vd for ocfs2-devel@oss.oracle.com; Wed, 28 Feb 2018 03:18:15 -0800 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1SBIElm022120 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 28 Feb 2018 11:18:14 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SBGsJf000940 for ; Wed, 28 Feb 2018 11:18:14 GMT Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by userp2030.oracle.com with ESMTP id 2gds59a6e2-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Feb 2018 11:18:14 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B1358AB49; Wed, 28 Feb 2018 11:18:10 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 9657D1E0503; Wed, 28 Feb 2018 12:18:09 +0100 (CET) From: Jan Kara To: ocfs2-devel@oss.oracle.com Date: Wed, 28 Feb 2018 12:17:58 +0100 Message-Id: <20180228111802.23967-3-jack@suse.cz> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180228111802.23967-1-jack@suse.cz> References: <20180228111802.23967-1-jack@suse.cz> X-CLX-Shades: MLX X-CLX-Response: 1TFkXGBkSEQpMehcZGhEKWU0XZ2ZyEQpZSRcacRoQGncGGBsScRkaGxAadwY YGgYaEQpZXhdoY3kRCklGF0VYS0lGT3VaWEVOX0leQ0VEGXVPSxEKQ04XQEBoXU1Yf0BsR0REG2 FFHE51fVljZ09vfHNSex1jdUYRClhcFx8EGgQbGBwHS0sYGB8eTxkFGxoEGxoaBB4SBB8QGx4aH xoRCl5ZF3hQbnl4EQpNXBceExMRCkxaF2hpQk1dEQpMRhdsa2sRCkNaFxsTHwQbGR8EGBgaBBsf EQpCXhcbEQpESRcfEQpCRhdlRnJnS1hbXkNbZhEKQlwXGhEKQkUXYAFhe1tae0ABYm0RCkJOF2U aeBsFBXBze1NZEQpCTBdtZHhifE97YUNfXxEKQmwXaX4YfEBfSBxOa1IRCkJAF2ASS05PXk1BGG FLEQpCWBdifW95AU8YGXBwexEKcGgXaGcFaF5MbUB9R0UQGRoRCnBoF2FyXnodARpkSWZFEBkaE QpwaBdsTHl5Eh54E0RLbBAZGhEKcGgXbBtMQmtbX11jTmYQGRoRCnBoF25fEl9yQEFkWgF7EBka EQpwbBdiQFptUEFDY3BfbRAZGhEKbX4XGhEKWE0XSxEg X-PDR: PASS X-Source-IP: 195.135.220.15 X-ServerName: mx2.suse.de X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:137.65.0.0/16 ip4:151.155.28.0/17 ip4:149.44.0.0/16 ip4:147.2.0.0/16 ip4:164.99.0.0/16 ip4:130.57.0.0/16 ip4:192.31.114.0/24 ip4:195.135.221.0/24 ip4:195.135.220.0/24 ip4:69.7.179.0/24 ip4:150.215.214.0/24 include:mailcontrol.com ~all X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=30 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=238 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=755 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280137 X-Spam: Clean Cc: Jan Kara Subject: [Ocfs2-devel] [PATCH 2/6] ocfs2: Fix quota recovery failure on unmount X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280137 X-Virus-Scanned: ClamAV using ClamSMTP When filesystem is unmounted while there is still some recovery work going on, it can happen that quotas get disabled before quota recovery is complete resulting in failed quota recovery and inconsistent quota accounting. Move disabling of recovery in ocfs2_dismount_volume() before disabling of quotas to fix this race. Signed-off-by: Jan Kara --- fs/ocfs2/super.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index ffa4952d432b..14c3d5ee6e24 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1904,6 +1904,13 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) /* Orphan scan should be stopped as early as possible */ ocfs2_orphan_scan_stop(osb); + /* + * This will disable recovery and flush any recovery work. This needs + * to happen before disabling quotas as quota recovery needs quotas + * enabled. + */ + ocfs2_recovery_exit(osb); + ocfs2_disable_quotas(osb); /* All dquots should be freed by now */ @@ -1915,9 +1922,6 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) ocfs2_truncate_log_shutdown(osb); - /* This will disable recovery and flush any recovery work. */ - ocfs2_recovery_exit(osb); - ocfs2_journal_shutdown(osb); ocfs2_sync_blockdev(sb);