Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2548091lqp; Mon, 25 Mar 2024 02:07:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMlqhGC6iHRmiGw9fOYHOJ4zWx6tOgEUJ20+5pDZWTKgiL4nh3qP172R00z9DTdWywaftShp+WHMahl42L++ykduDg2Ufa7Mah4gMH6A== X-Google-Smtp-Source: AGHT+IFxzr0aDzPyF7GPQUeuGAMxuBIa3Nj6BZmfdNWdWGCyEPeF2kMcR/CdHKZGNenRLIv9E9CO X-Received: by 2002:a92:c541:0:b0:368:7e16:d32c with SMTP id a1-20020a92c541000000b003687e16d32cmr8128481ilj.29.1711357621428; Mon, 25 Mar 2024 02:07:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711357621; cv=pass; d=google.com; s=arc-20160816; b=0ZxVlJE0jJnAz8I1jCwWh16dhga6ciHs7ap3DOWcmRhY1kf8IUgQe1Yjxs37YXmERR rmNg9pnE1NEyTvmpUBIB0RiiuGX/uf5N7+qEfv0i4SIUqMmo5VBisTp201H6t6b7xyEb jhshhWDJt+w29DN/OloLNJDDKCPbF4db4FzDbpnLO5YESwdweZtieI/W5I7CTjApejAi 8/UrU+9UbNuxWgUm+DWr7NhRAO8tZoeKhTYPReoxj83kA/8DgSsCYNRarZjpetCqasCl fshpAACQ+WebdBBd51tK0KQVIZMdT9y6MwsMpk0A4SvFiUulYb0jXtXtXDSJID1GUPmC brmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=S6d6jgPhBVIGDDOzLxNrELVb0o0ngTBhWHd40zXG4tk=; fh=12a/sEIKzFufS840P/8mjdllY8V10TQux2Vn471Up2g=; b=No8S23Tvv443jL6ntaiKTBe6WQr8Qlp/y93Npw/HRqXwoCNt4XxVfhTls69eA6Bu1x 9amaMX682Iwl9qlLLKMa4vXeFkCdxuLnoRXfHN2UpnlQ2FVzJVf6p5+LiPaTEbXKvdfS PovxJc3jtH+PKFqACh93cWNfopq8dEnbLeZ4fP/siPhkzYXa7RzjH+McWnQcJPKjqzC/ pm1iTAUe1WTMrmK7cJbRmJuF/HoNb8xlTiQx9sM/6khntcXbyJYy/eB4/LgD+Vbddj5+ YpcxX77QLWNTCuwsUkzmrqsaC5FOwlZN4GOBB7B7fqbtuigAhxpXDPKmNR6a3o8XTqx+ b/IA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1vR6gs8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f20-20020a631f14000000b005e85aa13467si6988803pgf.553.2024.03.25.02.07.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:07:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1vR6gs8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4475B29DEB for ; Mon, 25 Mar 2024 07:46:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 302EE246E18; Mon, 25 Mar 2024 02:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r1vR6gs8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8760814A611; Sun, 24 Mar 2024 22:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321024; cv=none; b=lbRj6wui8XEK6yszkTf0w7hOe/HbCVUVaEvXiZwVa62pesWFrJc2VkxR81nu+zjpBSxwL71FaJ0jLDGXTQMPfUsoc0Lk8t6oNVSfczU+O/43GNKi0cb4/n0EX2Lq0iLAomWRYI2+ps+vuzUCDdN4FQCURnhfxegiLFsvOMdpUJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321024; c=relaxed/simple; bh=dVQDY0+MQj8P3UOvJkNC+ZHiMUxAk+kHIchL/X2PMSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UoP23juF5xAwYU62GO6cwCA7QL+rBXExLgB2DhTQGeTr9Rif+vkB0vnMb2TTitKqXkp7s5JG/jaNsdGIlul5rLYIu4ghgXMhaRR85oykS+MfzbQuSR8ynWJV1DhfDdEmlGVGCq9QiEIeYhCLkSwOhj3rjxB+bwIXcFnrgkP6g0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r1vR6gs8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5630C43394; Sun, 24 Mar 2024 22:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321023; bh=dVQDY0+MQj8P3UOvJkNC+ZHiMUxAk+kHIchL/X2PMSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1vR6gs8qDhnXn9yA+Avk+TcXoac1e7rSzBXlhnfF7oD7kd+GVpupXMGYmDrfjY/r k8gvZAhEAqw81ebWY0kH5oraGcs16dDZL5dBSG1XQ1/epwLFnEK4IDrIz8+ZDeuNsm MSLMioocLF8d+SgAXJbzfZQFB+Fd/CnWbJRvq+MGzi5wPR5kWl7HUe/3TAgz+uzQmz sHs13B/igsCWPd6tVebSb+HmhPuZXK3w68VBz+mDoXcyfgHxpP6vnHIoXBbvElZkHV I+9lNDHp2XvMJ0hbETdTWaJyxT79ItjXIa33L7wSBggS1GRAVdqVdpq4p9e+Wt9FG5 e6FCOuD7PyTnQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.7 586/713] f2fs: fix to create selinux label during whiteout initialization Date: Sun, 24 Mar 2024 18:45:12 -0400 Message-ID: <20240324224720.1345309-587-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Chao Yu [ Upstream commit 40b2d55e045222dd6de2a54a299f682e0f954b03 ] #generic/700 - output mismatch (see /media/fstests/results//generic/700.out.bad) # --- tests/generic/700.out 2023-03-28 10:40:42.735529223 +0000 # +++ /media/fstests/results//generic/700.out.bad 2024-02-06 04:37:56.000000000 +0000 # @@ -1,2 +1,4 @@ # QA output created by 700 # +/mnt/scratch_f2fs/f1: security.selinux: No such attribute # +/mnt/scratch_f2fs/f2: security.selinux: No such attribute # Silence is golden # ... # (Run 'diff -u /media/fstests/tests/generic/700.out /media/fstests/results//generic/700.out.bad' to see the entire diff) HINT: You _MAY_ be missing kernel fix: 70b589a37e1a xfs: add selinux labels to whiteout inodes Previously, it missed to create selinux labels during whiteout inode initialization, fix this issue. Fixes: 7e01e7ad746b ("f2fs: support RENAME_WHITEOUT") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/dir.c | 5 +++-- fs/f2fs/f2fs.h | 3 ++- fs/f2fs/namei.c | 25 +++++++++++++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 042593aed1ec0..1b937f7d0414f 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -830,13 +830,14 @@ int f2fs_do_add_link(struct inode *dir, const struct qstr *name, return err; } -int f2fs_do_tmpfile(struct inode *inode, struct inode *dir) +int f2fs_do_tmpfile(struct inode *inode, struct inode *dir, + struct f2fs_filename *fname) { struct page *page; int err = 0; f2fs_down_write(&F2FS_I(inode)->i_sem); - page = f2fs_init_inode_metadata(inode, dir, NULL, NULL); + page = f2fs_init_inode_metadata(inode, dir, fname, NULL); if (IS_ERR(page)) { err = PTR_ERR(page); goto fail; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 007f39ff99b20..655e27e7bef9c 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3572,7 +3572,8 @@ int f2fs_do_add_link(struct inode *dir, const struct qstr *name, struct inode *inode, nid_t ino, umode_t mode); void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, struct inode *dir, struct inode *inode); -int f2fs_do_tmpfile(struct inode *inode, struct inode *dir); +int f2fs_do_tmpfile(struct inode *inode, struct inode *dir, + struct f2fs_filename *fname); bool f2fs_empty_dir(struct inode *dir); static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 7f71bae2c83b5..9cdf3f36d1b90 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -853,7 +853,7 @@ static int f2fs_mknod(struct mnt_idmap *idmap, struct inode *dir, static int __f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, struct file *file, umode_t mode, bool is_whiteout, - struct inode **new_inode) + struct inode **new_inode, struct f2fs_filename *fname) { struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct inode *inode; @@ -881,7 +881,7 @@ static int __f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, if (err) goto out; - err = f2fs_do_tmpfile(inode, dir); + err = f2fs_do_tmpfile(inode, dir, fname); if (err) goto release_out; @@ -932,22 +932,24 @@ static int f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, if (!f2fs_is_checkpoint_ready(sbi)) return -ENOSPC; - err = __f2fs_tmpfile(idmap, dir, file, mode, false, NULL); + err = __f2fs_tmpfile(idmap, dir, file, mode, false, NULL, NULL); return finish_open_simple(file, err); } static int f2fs_create_whiteout(struct mnt_idmap *idmap, - struct inode *dir, struct inode **whiteout) + struct inode *dir, struct inode **whiteout, + struct f2fs_filename *fname) { - return __f2fs_tmpfile(idmap, dir, NULL, - S_IFCHR | WHITEOUT_MODE, true, whiteout); + return __f2fs_tmpfile(idmap, dir, NULL, S_IFCHR | WHITEOUT_MODE, + true, whiteout, fname); } int f2fs_get_tmpfile(struct mnt_idmap *idmap, struct inode *dir, struct inode **new_inode) { - return __f2fs_tmpfile(idmap, dir, NULL, S_IFREG, false, new_inode); + return __f2fs_tmpfile(idmap, dir, NULL, S_IFREG, + false, new_inode, NULL); } static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir, @@ -990,7 +992,14 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir, } if (flags & RENAME_WHITEOUT) { - err = f2fs_create_whiteout(idmap, old_dir, &whiteout); + struct f2fs_filename fname; + + err = f2fs_setup_filename(old_dir, &old_dentry->d_name, + 0, &fname); + if (err) + return err; + + err = f2fs_create_whiteout(idmap, old_dir, &whiteout, &fname); if (err) return err; } -- 2.43.0