Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1355330pxb; Fri, 22 Jan 2021 13:38:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgj/x+1EFYqQ3Cw2X4t4rDOtWHLpvnPwm8wxQ7pgj6veaiJhNpQEPICDQNxxpImxvCn3qf X-Received: by 2002:a17:906:3404:: with SMTP id c4mr4439225ejb.86.1611351511591; Fri, 22 Jan 2021 13:38:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611351511; cv=none; d=google.com; s=arc-20160816; b=fCzxwApqBqUxZP8ujM3Vbf1k/y3NrV9ISgHhSAXt978ERma7dJ1SvPWk5pneRFsqJx ePQttMVTBaJPI5+Hn8NoogUuIKzPjtuAKUsXDw0VC0pVh7kb6U69U616v4jL3whRWTYi sJdq+84oMHHP52tqkeXm3a459oEUb32KVoOSTp5xQVI2Bc7Q4MMARbju3nQeNjJdUQOE 77dgp6ChsB4fJkbqXofqPvhsV++YHREQP82kmYCWBgnaTk7B9hSbmso56bWLhrW1EOP6 a502AyZsYTG6fXf5SNW5jd35Uv2bk2T2K82SRZIhWjXARhMrJOHFz9KUWueBJ1ZU6lYp g+/w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=P5tuEhv4Dxx4R/ySvhzalOoAfHBwTPZmy6oqT66WY9g=; b=Vdxi25obOcB0hybQm2lyAsiDOzJ8PVy2+FHT3Flj/DDKSs4YDaCig7lWA/+AVIz+ra ZOCrD30wfKxMl4F0bJiVXBbwKfTAA5QbB0vKqUZXxew05OYic7DPD5+JjxuuoIopdkeK O4KkB0JiKGBXPbHe4rL6yKqNz+u40w2X6k1bYYJTl792zqiCFIDUSAXjNP4EqnnbZQ3o OKwd+hC5jgzVYZGhXjbnIrYgyWTUm86R0mNJoKBmPfH+BkGQo+RVbNPGroTWgspsdvkh FqIgoa4IDYXFoS7FDXr60kKAzI4IKxGGXZIOttzEJYIjmiGWvUqCMMlSpb72KAm++szx WMpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si4250090edz.582.2021.01.22.13.38.07; Fri, 22 Jan 2021 13:38:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729976AbhAVVhN (ORCPT + 99 others); Fri, 22 Jan 2021 16:37:13 -0500 Received: from lilium.sigma-star.at ([109.75.188.150]:32914 "EHLO lilium.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729322AbhAVVcC (ORCPT ); Fri, 22 Jan 2021 16:32:02 -0500 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id AD32B181CBE05; Fri, 22 Jan 2021 22:22:35 +0100 (CET) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id gZrYYPdzlWYm; Fri, 22 Jan 2021 22:22:35 +0100 (CET) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id U1pPPa_0HFNy; Fri, 22 Jan 2021 22:22:35 +0100 (CET) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: david@sigma-star.at, richard@nod.at, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 3/4] ubifs: Update directory size when creating whiteouts Date: Fri, 22 Jan 2021 22:22:28 +0100 Message-Id: <20210122212229.17072-4-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210122212229.17072-1-richard@nod.at> References: <20210122212229.17072-1-richard@nod.at> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Although whiteouts are unlinked files they will get re-linked later, therefore the size of the parent directory needs to be updated too. Cc: stable@vger.kernel.org Fixes: 9e0a1fff8db5 ("ubifs: Implement RENAME_WHITEOUT") Signed-off-by: Richard Weinberger --- fs/ubifs/dir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 8a34e0118ee9..b5d523e5854f 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -361,6 +361,7 @@ static int do_tmpfile(struct inode *dir, struct dentr= y *dentry, struct ubifs_budget_req ino_req =3D { .dirtied_ino =3D 1 }; struct ubifs_inode *ui, *dir_ui =3D ubifs_inode(dir); int err, instantiated =3D 0; + int sz_change =3D 0; struct fscrypt_name nm; =20 /* @@ -411,6 +412,8 @@ static int do_tmpfile(struct inode *dir, struct dentr= y *dentry, mark_inode_dirty(inode); drop_nlink(inode); *whiteout =3D inode; + sz_change =3D CALC_DENT_SIZE(fname_len(&nm)); + dir->i_size +=3D sz_change; } else { d_tmpfile(dentry, inode); } @@ -430,6 +433,7 @@ static int do_tmpfile(struct inode *dir, struct dentr= y *dentry, return 0; =20 out_cancel: + dir->i_size -=3D sz_change; mutex_unlock(&dir_ui->ui_mutex); out_inode: make_bad_inode(inode); --=20 2.26.2