From patchwork Wed Apr 4 19:06:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10323045 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 9576A60467 for ; Wed, 4 Apr 2018 19:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8316527D0E for ; Wed, 4 Apr 2018 19:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7747228F5A; Wed, 4 Apr 2018 19:06:20 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10F4227D0E for ; Wed, 4 Apr 2018 19:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbeDDTGT (ORCPT ); Wed, 4 Apr 2018 15:06:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50058 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbeDDTGT (ORCPT ); Wed, 4 Apr 2018 15:06:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC374C03D46B for ; Wed, 4 Apr 2018 19:06:18 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1EA47F6D9 for ; Wed, 4 Apr 2018 19:06:18 +0000 (UTC) Subject: [PATCH 4/6] xfs: quieter quota initialization with bad dquots From: Eric Sandeen To: linux-xfs References: Message-ID: <2ce33875-44dc-539c-50a9-c8808bd4b185@redhat.com> Date: Wed, 4 Apr 2018 14:06:17 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 04 Apr 2018 19:06:18 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As of now, when we start quotacheck we read quotas with verifiers, then reread without them, if we saw corruption. This is so the corruption is noted in the logs; this is all well and good, except that the verifier errors instruct the user to run xfs_repair, which won't actually do anything for corrupt dqblks. We can quiet this down by doing the initial read without verifiers, knowing that we're going to validate the dqblks manually in later stages, and repair them if needed. This adds new (more terse) messages stating whether a corrupted dquot was found and fixed. Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- I'm a bit on the fence about this one; we lose the hexdump too so we won't see what was wrong (I could add that back in, I suppose). fs/xfs/libxfs/xfs_dquot_buf.c | 4 ++++ fs/xfs/xfs_qm.c | 30 +++++++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c index 9f8b2c5..c13d440 100644 --- a/fs/xfs/libxfs/xfs_dquot_buf.c +++ b/fs/xfs/libxfs/xfs_dquot_buf.c @@ -136,6 +136,10 @@ XFS_DQUOT_CRC_OFF); } + xfs_alert(mp, "Repaired %s quota block for id %d.", + type == XFS_DQ_USER ? "user" : + (type == XFS_DQ_GROUP ? "group" : "project"), id); + return 0; } diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index b422382..328d770 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -868,8 +868,12 @@ struct xfs_qm_isolate { * xfs_dquot_verify. */ fa = xfs_dquot_verify(mp, &dqb[j], id + j, type); - if (fa) + if (fa) { + xfs_alert(mp, +"Metadata corruption error detected at %pS, xfs_dquot block 0x%llx.", + __this_address, bp->b_bn); xfs_dquot_repair(mp, &dqb[j], id + j, type); + } /* * Reset type in case we are reusing group quota file for @@ -922,24 +926,16 @@ struct xfs_qm_isolate { * everything if we were to crash in the middle of this loop. */ while (blkcnt--) { - error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, bno), - mp->m_quotainfo->qi_dqchunklen, 0, &bp, - &xfs_dquot_buf_ops); - /* - * CRC and validation errors will return a EFSCORRUPTED here. If - * this occurs, re-read without CRC validation so that we can - * repair the damage via xfs_qm_reset_dqcounts(). This process - * will leave a trace in the log indicating corruption has - * been detected. + * CRC and validation errors are possible here. Because + * this may occur, we read without CRC validation so that we can + * repair the damage via xfs_qm_reset_dqcounts(). + * Errors will be detected, declared, and repaired later in the + * quotacheck process. */ - if (error == -EFSCORRUPTED) { - error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, bno), - mp->m_quotainfo->qi_dqchunklen, 0, &bp, - NULL); - } + error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, + XFS_FSB_TO_DADDR(mp, bno), + mp->m_quotainfo->qi_dqchunklen, 0, &bp, NULL); if (error) break;