Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6418941pxb; Tue, 15 Feb 2022 01:55:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmWS96Cv45AjsCq+DdZlrVqtH+D23jUPsS+pd4x5dGNkuDv2UNq2eNKeH+eQnVDBcdSBcR X-Received: by 2002:a17:90b:33c4:b0:1b9:3aa6:e3e0 with SMTP id lk4-20020a17090b33c400b001b93aa6e3e0mr3537003pjb.182.1644918920463; Tue, 15 Feb 2022 01:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644918920; cv=none; d=google.com; s=arc-20160816; b=tpOh1DcLymaPXjJxq9AJO1lbTyRnGHS8VOs8y1ZgnOKek0K67jkRH99H5UZi3L5Irb B20sE7b/p+m7EQ3Z4saiP5SFPL2SJwZEyHJuEIjfbnp+MZnP+/++BY5uwXjfe0s9Qp9a U/xOcw5HP6aVRnKO7RuHmLs/7fljnNCXZNL/yWXuKH1mmgLsg96+Xt+LVv2MxsMbDz2u LWCxF4wjmE7pxymvs+cXRBkA5iQb1P3MkqUHx3s0ICbaIWhj30n20UOg6Yvat505GCoW RVfWGFLnLaOuW9jJDdvGLgLeefMWSZ85UdIM/46JdFVLTfBUblYLBmE6vJ33Z0l3pGOk MSYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UOtADLYO41V+r9rZuJfDLIHy8uY5YpL/ZE5Zu86unT4=; b=Ti5PyaBUDeqPpQPdZGzHs3IvCTbsE79gW6QuFgRI2X7Csv4MF//cuBhFMILBvJe5Ls pvhXZioBbfc7KLBOgjKBLcNnGPJ+5Lc/1qVSinWtFh2dtXEPANCZWZ0AgNgQRCs/djp/ EqBFtT/E7BRzijtImvv4Ft+DeZkowUKjySl1dEaTeBgY+YpXX/nhWfQlmj///vH04d4p QpRG+sjKQlw34x3kbPRMFvH+W44mll0cvjTYj8znVDEhGOMJoY1/wWObnZPsNpbq/a4A nYEGVlbshk0VcpHOuv9ZYg9J//eYEpeY43gu9qARyHtAtn437fuzsZRB2xZJSjonlt7l rf0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12si2226181pgb.18.2022.02.15.01.55.05; Tue, 15 Feb 2022 01:55:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbiBODwC (ORCPT + 99 others); Mon, 14 Feb 2022 22:52:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiBODwA (ORCPT ); Mon, 14 Feb 2022 22:52:00 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5D810783D for ; Mon, 14 Feb 2022 19:51:50 -0800 (PST) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JyRvS04FXzccm8; Tue, 15 Feb 2022 11:50:44 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 11:51:48 +0800 From: Baokun Li To: , , CC: , , Zhihao Cheng Subject: [PATCH -next] ubifs: rename_whiteout: correct old_dir size computing Date: Tue, 15 Feb 2022 12:07:36 +0800 Message-ID: <20220215040736.2839939-1-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500020.china.huawei.com (7.185.36.88) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When renaming the whiteout file, the old whiteout file is not deleted. Therefore, we add the old dentry size to the old dir like XFS. Otherwise, an error may be reported due to `fscki->calc_sz != fscki->size` in check_indes. Fixes: 9e0a1fff8db56ea ("ubifs: Implement RENAME_WHITEOUT") Reported-by: Zhihao Cheng Signed-off-by: Baokun Li --- fs/ubifs/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index ae082a0be2a3..86151889548e 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1402,6 +1402,9 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, iput(whiteout); goto out_release; } + + /* Add the old_dentry size to the old_dir size. */ + old_sz -= CALC_DENT_SIZE(fname_len(&old_nm)); } lock_4_inodes(old_dir, new_dir, new_inode, whiteout); -- 2.31.1