From patchwork Thu Oct 26 22:15:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10028813 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 CA84E60381 for ; Thu, 26 Oct 2017 22:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB88D28E68 for ; Thu, 26 Oct 2017 22:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B065928E74; Thu, 26 Oct 2017 22:15:38 +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, UNPARSEABLE_RELAY 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 948C928E68 for ; Thu, 26 Oct 2017 22:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932351AbdJZWPg (ORCPT ); Thu, 26 Oct 2017 18:15:36 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:28918 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932346AbdJZWPf (ORCPT ); Thu, 26 Oct 2017 18:15:35 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9QMFXNn009692 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Oct 2017 22:15:33 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v9QMFXRF000442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Oct 2017 22:15:33 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v9QMFXkZ016496; Thu, 26 Oct 2017 22:15:33 GMT Received: from localhost (/10.145.178.58) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Oct 2017 15:15:32 -0700 Subject: [PATCH 06/10] xfs_repair: fix cowextsize field checking and repairing From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 26 Oct 2017 15:15:31 -0700 Message-ID: <150905613147.28563.3642613984403228295.stgit@magnolia> In-Reply-To: <150905608689.28563.9670731739870415773.stgit@magnolia> References: <150905608689.28563.9670731739870415773.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: userv0021.oracle.com [156.151.31.71] 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 From: Darrick J. Wong Make sure that we never leave the filesystem with a zero cowextsize hint while the cowextsize inode flag is set. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- repair/dinode.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/repair/dinode.c b/repair/dinode.c index e62ec33..32cc769 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -2694,6 +2694,7 @@ _("Cannot have non-zero CoW extent size %u on non-cowextsize inode %" PRIu64 ", be32_to_cpu(dino->di_cowextsize), lino); if (!no_modify) { do_warn(_("resetting to zero\n")); + dino->di_flags2 &= ~cpu_to_be64(XFS_DIFLAG2_COWEXTSIZE); dino->di_cowextsize = 0; *dirty = 1; } else @@ -2702,6 +2703,24 @@ _("Cannot have non-zero CoW extent size %u on non-cowextsize inode %" PRIu64 ", } /* + * Can't have the COWEXTSIZE flag set with no hint. + */ + if (dino->di_version >= 3 && + be32_to_cpu(dino->di_cowextsize) == 0 && + (be64_to_cpu(dino->di_flags2) & XFS_DIFLAG2_COWEXTSIZE)) { + do_warn( +_("Cannot have CoW extent size of zero on cowextsize inode %" PRIu64 ", "), + lino); + if (!no_modify) { + do_warn(_("clearing cowextsize flag\n")); + dino->di_flags2 &= ~cpu_to_be64(XFS_DIFLAG2_COWEXTSIZE); + *dirty = 1; + } else { + do_warn(_("would clear cowextsize flag\n")); + } + } + + /* * general size/consistency checks: */ if (process_check_inode_sizes(mp, dino, lino, type) != 0)