Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2403729lqp; Sun, 24 Mar 2024 18:05:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQxApGmoFaGktt1OfrWQLysdxtj65Cu3E/5TbyklVy2L4cogiMMh9q7m2svDDl8G50qtYd84x3b9q9MMdkCnA6CAbbQwadv7wb04cShw== X-Google-Smtp-Source: AGHT+IFNgUth/nsNDbmfmvX4/euBbGx/Qz/ZcuCWKeiV+lMk9pSs1w4FyiVE+y6UYy8SYbVuDt1W X-Received: by 2002:a17:90a:f495:b0:29c:2f5d:f122 with SMTP id bx21-20020a17090af49500b0029c2f5df122mr3498620pjb.7.1711328722388; Sun, 24 Mar 2024 18:05:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328722; cv=pass; d=google.com; s=arc-20160816; b=Xx9Dj0UinD/0u+1oSTrDgrZCxFtQsJv6ohPdil7LkJ6WUwYMNl36G7jfzyGQxvNAoK J+vB9jYXQTeh4Fxomid5lwbSFEQjB7SoI0X4mrPV4qHmX+P3JTb/sFI8AiF2xz23o+dr TPKi192qm/hYiZ7iSZySggUJlRxD4fJRf0kNqokeLmbXMC365Vkp6Dj1dmOsU9ngxCqu 8LdAodRHTOVrjaHNA79adGVQ6rLQ0F8vnbymc03OFzzgm8wbCYa5MZx9+xtZT1BptcJV QOiCBRnY8LAhP/cSv4o9FyKAnDEYjh21KHcllDrECBTQRlRfaw5bVtXWNYKOZi3ItPHT hCEw== 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=XRQl8hOtvNWNutCXBO5Z2LADt4aYN/hQ8VV0IiLgKxc=; fh=12a/sEIKzFufS840P/8mjdllY8V10TQux2Vn471Up2g=; b=lZbatSOtzVbZnr4GvEcpv59oPjCY5J8YqRRujyhfnpBY63afv0eSyQWEUmkMQoKT9k ua0Sbh21AvBPtMWveTrqdCS+S0/c/qDelzk5drr1jMSUprnRcqyViUZ9WBPhP6OPKwPa cOX3YecDw29rQiOIgdEu43k8KTGmx4brWrb7w0XLfVznNeSZN/Yp0WrfZz7/yjUWfPYH FL5zQquMBOwWFyqPbBz39rKDeci74Vh6YrtAHguWsrJw3jKTowWmxMsOabuCuL55SmZH fCQ1GCxFP683cZJibr3sbSSFjZ+ksmgzBpajSx8W/7vdeukr57AkrVBBzbEItwZT8e4M ZuxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Z2n98/ri"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113465-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. [147.75.48.161]) by mx.google.com with ESMTPS id q3-20020a17090a178300b0029b24831646si10298570pja.128.2024.03.24.18.05.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:05:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Z2n98/ri"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113465-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 9240AB218B2 for ; Mon, 25 Mar 2024 00:43:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 548DF13B5A0; Sun, 24 Mar 2024 22:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z2n98/ri" 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 5FAC01B16BA; Sun, 24 Mar 2024 22:44:26 +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=1711320266; cv=none; b=Ep3DE3YWFFj0+0F9wsaPYVMymc8ciCfhGyskBvo6fJeHwqLupWTPb/0biGb93bwCVevKZ1+weeQOObtTgELkl/du2j9noF+oUU+E+kNwPVXpzPfR5SAxEQ54k8zqTCXpkyRBWIybLYtKEsQv6HdVUC8qYm6Y5U6eP4/JBbOe/oQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320266; c=relaxed/simple; bh=U/CAVc1cRdMrCqOPJcOzTMp/9RbIZOm0+M3ducGKG2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S64xvyDv6QMqdufMISLH+7LcIObuxH3JjdPZJI5+Uv7yY0G2ygDi5A9dr5VBxdilhP+P1WS8eNVPHubWX/MC4E6f9f5QV6cOtztaacbs8QeOHjhz/qnZScMgvnkcNaF1C6lCUjTXCqyyA8bUjxJ7SUcCrxk5dDVUXjMSXsoD/uY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z2n98/ri; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1F0BC433F1; Sun, 24 Mar 2024 22:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320266; bh=U/CAVc1cRdMrCqOPJcOzTMp/9RbIZOm0+M3ducGKG2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2n98/ri6B46byJpKY77JIiTCzE73zEC5PJsZ45Cjv6OVxssqEYee54bY6gWumeh8 9i7AxPBpjrpEjxKCx9pM8shIBdi5W8BgjxlvjKMu6YJPJG0N0/DXDPUT1RQlFCNtLm o/Xk3YukdCxkD6lqmWRZYottfW3jQg+o5O1XIm6WeM9eb+neD4LBa+pxTwt4t91sZ7 81Yzh5sdyBuZXMd6ff8/TrFjokREDLSU37ivvRkgAXpVtQ6Biot4ngTXskJKnqYmJG QUxhbClPo2J1w1jlG+BBpDuj6lj2IYtHerpxyS0r6eohTpp4I9puRtC0KGclJFEAXr fgaVQSAxpPPPw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.8 574/715] f2fs: fix to create selinux label during whiteout initialization Date: Sun, 24 Mar 2024 18:32:33 -0400 Message-ID: <20240324223455.1342824-575-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 cadda74e06f61..eb12d1f6cd96f 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3579,7 +3579,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 b3bb815fc6aa4..550cc811e008a 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -852,7 +852,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; @@ -880,7 +880,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; @@ -931,22 +931,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