From patchwork Thu Dec 14 06:47:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 10111567 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 A3869603FA for ; Thu, 14 Dec 2017 06:42:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9210F29B0B for ; Thu, 14 Dec 2017 06:42:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8707629B44; Thu, 14 Dec 2017 06:42:11 +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 3888529B11 for ; Thu, 14 Dec 2017 06:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751729AbdLNGmK (ORCPT ); Thu, 14 Dec 2017 01:42:10 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11991 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdLNGmG (ORCPT ); Thu, 14 Dec 2017 01:42:06 -0500 Received: from 172.30.72.60 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DMD34189; Thu, 14 Dec 2017 14:41:53 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.361.1; Thu, 14 Dec 2017 14:41:43 +0800 From: "zhangyi (F)" To: , CC: , , , , , Subject: [PATCH v2 12/18] fsck.overlay: remove duplicate redirect xattr in yes mode Date: Thu, 14 Dec 2017 14:47:41 +0800 Message-ID: <20171214064747.20999-13-yi.zhang@huawei.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171214064747.20999-1-yi.zhang@huawei.com> References: <20171214064747.20999-1-yi.zhang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5A321D32.0019, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 795ad040d646ea6b16c0e1c74ccce0b1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For the duplicate redirect directories which point to the same origin, we cannot confirm which one is invalid now, so cannot remove it in 'auto' mode for safty reason. But in 'yes' mode, we remove the duplicate one directly for consistency. Signed-off-by: zhangyi (F) --- check.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/check.c b/check.c index 99cd95a..1e40cac 100644 --- a/check.c +++ b/check.c @@ -378,7 +378,8 @@ static void ovl_redirect_free(void) * 1) Check the origin directory exist or not. If not, remove xattr. * 2) Count how many directories the origin directory was redirected by. * If more than one in the same layer, there must be some inconsistency - * but not sure, just warn. + * but not sure which one is invalid, just warn in 'auto' mode and remove + * the duplicate one in 'yes' mode. * 3) Check and fix the missing whiteout or opaque in redierct parent dir. */ static int ovl_check_redirect(struct scan_ctx *sctx) @@ -420,7 +421,11 @@ static int ovl_check_redirect(struct scan_ctx *sctx) chk.path, pathname, tmp); sctx->redirects[SC_INVALID]++; - set_st_inconsistency(&status); + + /* Don't remove in auto mode */ + if (ovl_ask_invalid("Duplicate redirect xattr", + pathname, 0)) + goto remove_d; } ovl_redirect_entry_add(pathname, sctx->dirtype, @@ -461,7 +466,7 @@ remove: /* Remove redirect xattr or ask user */ if (!ovl_ask_invalid("Invalid redirect xattr", pathname, 1)) goto out; - +remove_d: ret = ovl_remove_redirect(pathname); if (!ret) sctx->redirects[SC_INVALID_DEL]++;