f2fs: fix to create selinux label during whiteout initialization
[ 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:70b589a37e
xfs: add selinux labels to whiteout inodes Previously, it missed to create selinux labels during whiteout inode initialization, fix this issue. Fixes:7e01e7ad74
("f2fs: support RENAME_WHITEOUT") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a2b6d56416
commit
7525dec4b3
|
@ -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;
|
||||
|
|
|
@ -3569,7 +3569,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)
|
||||
|
|
|
@ -853,7 +853,7 @@ out:
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue