Remove PTR_ERR from unused code path and
assign error value where it exactly happens.
Signed-off-by: wenjun93 <[email protected]>
---
fs/overlayfs/copy_up.c | 8 ++++----
fs/overlayfs/dir.c | 46 ++++++++++++++++++++----------------------
fs/overlayfs/export.c | 10 ++++-----
fs/overlayfs/namei.c | 16 +++++++--------
fs/overlayfs/readdir.c | 2 +-
fs/overlayfs/super.c | 41 ++++++++++++++++++-------------------
fs/overlayfs/util.c | 2 +-
7 files changed, 61 insertions(+), 64 deletions(-)
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index f658cc8ea492..1e243b7082df 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -507,8 +507,8 @@ static int ovl_create_index(struct dentry *dentry, struct dentry *origin,
return err;
temp = ovl_create_temp(ofs, indexdir, OVL_CATTR(S_IFDIR | 0));
- err = PTR_ERR(temp);
if (IS_ERR(temp))
+ err = PTR_ERR(temp);
goto free_name;
err = ovl_set_upper_fh(ofs, upper, temp);
@@ -705,8 +705,8 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
};
/* workdir and destdir could be the same when copying up to indexdir */
- err = -EIO;
if (lock_rename(c->workdir, c->destdir) != NULL)
+ err = -EIO;
goto unlock;
err = ovl_prep_cu_creds(c->dentry, &cc);
@@ -716,8 +716,8 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
temp = ovl_create_temp(ofs, c->workdir, &cattr);
ovl_revert_cu_creds(&cc);
- err = PTR_ERR(temp);
if (IS_ERR(temp))
+ err = PTR_ERR(temp);
goto unlock;
/*
@@ -741,8 +741,8 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
upper = ovl_lookup_upper(ofs, c->destname.name, c->destdir,
c->destname.len);
- err = PTR_ERR(upper);
if (IS_ERR(upper))
+ err = PTR_ERR(upper);
goto cleanup;
err = ovl_do_rename(ofs, wdir, temp, udir, upper, 0);
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index fc25fb95d5fc..6c5fedc9ec89 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -115,8 +115,8 @@ int ovl_cleanup_and_whiteout(struct ovl_fs *ofs, struct inode *dir,
int flags = 0;
whiteout = ovl_whiteout(ofs);
- err = PTR_ERR(whiteout);
if (IS_ERR(whiteout))
+ err = PTR_ERR(whiteout);
return err;
if (d_is_dir(dentry))
@@ -176,8 +176,8 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, struct inode *dir,
if (IS_ERR(newdentry))
return newdentry;
- err = -ESTALE;
if (newdentry->d_inode)
+ err = -ESTALE;
goto out;
if (attr->hardlink) {
@@ -336,8 +336,8 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
ovl_lookup_upper(ofs, dentry->d_name.name,
upperdir, dentry->d_name.len),
attr);
- err = PTR_ERR(newdentry);
if (IS_ERR(newdentry))
+ err = PTR_ERR(newdentry);
goto out_unlock;
if (ovl_type_merge(dentry->d_parent) && d_is_dir(newdentry) &&
@@ -394,8 +394,8 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry,
goto out_unlock;
opaquedir = ovl_create_temp(ofs, workdir, OVL_CATTR(stat.mode));
- err = PTR_ERR(opaquedir);
if (IS_ERR(opaquedir))
+ err = PTR_ERR(opaquedir);
goto out_unlock;
err = ovl_copy_xattr(dentry->d_sb, &upperpath, opaquedir);
@@ -473,17 +473,17 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
upper = ovl_lookup_upper(ofs, dentry->d_name.name, upperdir,
dentry->d_name.len);
- err = PTR_ERR(upper);
if (IS_ERR(upper))
+ err = PTR_ERR(upper);
goto out_unlock;
- err = -ESTALE;
if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper)))
+ err = -ESTALE;
goto out_dput;
newdentry = ovl_create_temp(ofs, workdir, cattr);
- err = PTR_ERR(newdentry);
if (IS_ERR(newdentry))
+ err = PTR_ERR(newdentry);
goto out_dput;
/*
@@ -577,9 +577,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
}
if (!attr->hardlink) {
- err = -ENOMEM;
override_cred = prepare_creds();
if (!override_cred)
+ err = -ENOMEM;
goto out_revert_creds;
/*
* In the creation cases(create, mkdir, mknod, symlink),
@@ -632,9 +632,9 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev,
goto out;
/* Preallocate inode to be used by ovl_get_inode() */
- err = -ENOMEM;
inode = ovl_new_inode(dentry->d_sb, mode, rdev);
if (!inode)
+ err = -ENOMEM;
goto out_drop_write;
spin_lock(&inode->i_lock);
@@ -759,8 +759,8 @@ static int ovl_remove_and_whiteout(struct dentry *dentry,
if (!list_empty(list)) {
opaquedir = ovl_clear_empty(dentry, list);
- err = PTR_ERR(opaquedir);
if (IS_ERR(opaquedir))
+ err = PTR_ERR(opaquedir);
goto out;
}
@@ -770,14 +770,14 @@ static int ovl_remove_and_whiteout(struct dentry *dentry,
upper = ovl_lookup_upper(ofs, dentry->d_name.name, upperdir,
dentry->d_name.len);
- err = PTR_ERR(upper);
if (IS_ERR(upper))
+ err = PTR_ERR(upper);
goto out_unlock;
- err = -ESTALE;
if ((opaquedir && upper != opaquedir) ||
(!opaquedir && ovl_dentry_upper(dentry) &&
!ovl_matches_upper(dentry, upper))) {
+ err = -ESTALE;
goto out_dput_upper;
}
@@ -810,21 +810,21 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir,
if (!list_empty(list)) {
opaquedir = ovl_clear_empty(dentry, list);
- err = PTR_ERR(opaquedir);
if (IS_ERR(opaquedir))
+ err = PTR_ERR(opaquedir);
goto out;
}
inode_lock_nested(dir, I_MUTEX_PARENT);
upper = ovl_lookup_upper(ofs, dentry->d_name.name, upperdir,
dentry->d_name.len);
- err = PTR_ERR(upper);
if (IS_ERR(upper))
+ err = PTR_ERR(upper);
goto out_unlock;
- err = -ESTALE;
if ((opaquedir && upper != opaquedir) ||
(!opaquedir && !ovl_matches_upper(dentry, upper)))
+ err = -ESTALE;
goto out_dput_upper;
if (is_dir)
@@ -1098,17 +1098,15 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
struct ovl_fs *ofs = OVL_FS(old->d_sb);
LIST_HEAD(list);
- err = -EINVAL;
if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE))
+ err = -EINVAL;
goto out;
flags &= ~RENAME_NOREPLACE;
/* Don't copy up directory trees */
- err = -EXDEV;
- if (!ovl_can_move(old))
- goto out;
- if (!overwrite && !ovl_can_move(new))
+ if (!ovl_can_move(old) || (!overwrite && !ovl_can_move(new)))
+ err = -EXDEV;
goto out;
if (overwrite && new_is_dir && !ovl_pure_upper(new)) {
@@ -1159,8 +1157,8 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
if (!list_empty(&list)) {
opaquedir = ovl_clear_empty(new, &list);
- err = PTR_ERR(opaquedir);
if (IS_ERR(opaquedir)) {
+ err = PTR_ERR(opaquedir);
opaquedir = NULL;
goto out_revert_creds;
}
@@ -1192,18 +1190,18 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
olddentry = ovl_lookup_upper(ofs, old->d_name.name, old_upperdir,
old->d_name.len);
- err = PTR_ERR(olddentry);
if (IS_ERR(olddentry))
+ err = PTR_ERR(olddentry);
goto out_unlock;
- err = -ESTALE;
if (!ovl_matches_upper(old, olddentry))
+ err = -ESTALE;
goto out_dput_old;
newdentry = ovl_lookup_upper(ofs, new->d_name.name, new_upperdir,
new->d_name.len);
- err = PTR_ERR(newdentry);
if (IS_ERR(newdentry))
+ err = PTR_ERR(newdentry);
goto out_dput_old;
old_opaque = ovl_dentry_is_opaque(old);
diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index defd4e231ad2..a9a4c0e4a772 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -379,9 +379,9 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected,
* connected real path from the top.
*/
inode_lock_nested(dir, I_MUTEX_PARENT);
- err = -ECHILD;
parent = dget_parent(real);
if (ovl_dentry_real_at(connected, layer->idx) != parent)
+ err = -ECHILD;
goto fail;
/*
@@ -716,8 +716,8 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
if (!d_is_dir(origin.dentry) ||
!(origin.dentry->d_flags & DCACHE_DISCONNECTED)) {
inode = ovl_lookup_inode(sb, origin.dentry, false);
- err = PTR_ERR(inode);
if (IS_ERR(inode))
+ err = PTR_ERR(inode);
goto out_err;
if (inode) {
dentry = d_find_any_alias(inode);
@@ -730,8 +730,8 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
/* Then lookup indexed upper/whiteout by origin fh */
if (ofs->indexdir) {
index = ovl_get_index_fh(ofs, fh);
- err = PTR_ERR(index);
if (IS_ERR(index)) {
+ err = PTR_ERR(index);
index = NULL;
goto out_err;
}
@@ -741,8 +741,8 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
if (index && d_is_dir(index)) {
struct dentry *upper = ovl_index_upper(ofs, index, true);
- err = PTR_ERR(upper);
if (IS_ERR_OR_NULL(upper))
+ err = PTR_ERR(upper);
goto out_err;
dentry = ovl_get_dentry(sb, upper, NULL, NULL);
@@ -810,8 +810,8 @@ static struct dentry *ovl_fh_to_dentry(struct super_block *sb, struct fid *fid,
int err;
fh = ovl_fid_to_fh(fid, len, fh_type);
- err = PTR_ERR(fh);
if (IS_ERR(fh))
+ err = PTR_ERR(fh);
goto out_err;
err = ovl_check_fh_len(fh, len);
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index cfb3420b7df0..c74625a4bec5 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -462,8 +462,8 @@ int ovl_verify_set_fh(struct ovl_fs *ofs, struct dentry *dentry,
int err;
fh = ovl_encode_real_fh(ofs, real, is_upper);
- err = PTR_ERR(fh);
if (IS_ERR(fh)) {
+ err = PTR_ERR(fh);
fh = NULL;
goto fail;
}
@@ -533,18 +533,18 @@ int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
if (!d_inode(index))
return 0;
- err = -EINVAL;
if (index->d_name.len < sizeof(struct ovl_fb)*2)
+ err = -EINVAL;
goto fail;
- err = -ENOMEM;
len = index->d_name.len / 2;
fh = kzalloc(len + OVL_FH_WIRE_OFFSET, GFP_KERNEL);
if (!fh)
+ err = -ENOMEM;
goto fail;
- err = -EINVAL;
if (hex2bin(fh->buf, index->d_name.name, len))
+ err = -EINVAL;
goto fail;
err = ovl_check_fb_len(&fh->fb, len);
@@ -905,10 +905,10 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
}
if (!d.stop && poe->numlower) {
- err = -ENOMEM;
stack = kcalloc(ofs->numlayer - 1, sizeof(struct ovl_path),
GFP_KERNEL);
if (!stack)
+ err = -ENOMEM;
goto out_put_upper;
}
@@ -994,10 +994,10 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* Only following redirects when redirects are enabled disables
* this attack vector when not necessary.
*/
- err = -EPERM;
if (d.redirect && !ofs->config.redirect_follow) {
pr_warn_ratelimited("refusing to follow redirect for (%pd2)\n",
dentry);
+ err = -EPERM;
goto out_put;
}
@@ -1068,8 +1068,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
}
oe = ovl_alloc_entry(ctr);
- err = -ENOMEM;
if (!oe)
+ err = -ENOMEM;
goto out_put;
memcpy(oe->lowerstack, stack, sizeof(struct ovl_path) * ctr);
@@ -1115,8 +1115,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
};
inode = ovl_get_inode(dentry->d_sb, &oip);
- err = PTR_ERR(inode);
if (IS_ERR(inode))
+ err = PTR_ERR(inode);
goto out_free_oe;
if (upperdentry && !uppermetacopy)
ovl_set_flag(OVL_UPPERDATA, inode);
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index b6952b21a7ee..5da31635a597 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -764,8 +764,8 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx)
struct ovl_dir_cache *cache;
cache = ovl_cache_get(dentry);
- err = PTR_ERR(cache);
if (IS_ERR(cache))
+ err = PTR_ERR(cache);
goto out;
od->cache = cache;
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index f97ad8b40dbb..268d2ca232a0 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -801,8 +801,8 @@ static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
goto out_dput;
/* Weird filesystem returning with hashed negative (kernfs)? */
- err = -EINVAL;
if (d_really_is_negative(work))
+ err = -EINVAL;
goto out_dput;
/*
@@ -1130,8 +1130,8 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs,
goto out;
upper_mnt = clone_private_mount(upperpath);
- err = PTR_ERR(upper_mnt);
if (IS_ERR(upper_mnt)) {
+ err = PTR_ERR(upper_mnt);
pr_err("failed to clone upperpath\n");
goto out;
}
@@ -1184,13 +1184,13 @@ static int ovl_check_rename_whiteout(struct ovl_fs *ofs)
inode_lock_nested(dir, I_MUTEX_PARENT);
temp = ovl_create_temp(ofs, workdir, OVL_CATTR(S_IFREG | 0));
- err = PTR_ERR(temp);
if (IS_ERR(temp))
+ err = PTR_ERR(temp);
goto out_unlock;
dest = ovl_lookup_temp(ofs, workdir);
- err = PTR_ERR(dest);
if (IS_ERR(dest)) {
+ err = PTR_ERR(dest);
dput(temp);
goto out_unlock;
}
@@ -1205,8 +1205,8 @@ static int ovl_check_rename_whiteout(struct ovl_fs *ofs)
}
whiteout = ovl_lookup_upper(ofs, name.name.name, workdir, name.name.len);
- err = PTR_ERR(whiteout);
if (IS_ERR(whiteout))
+ err = PTR_ERR(whiteout);
goto cleanup_temp;
err = ovl_is_whiteout(whiteout);
@@ -1284,8 +1284,8 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
return err;
workdir = ovl_workdir_create(ofs, OVL_WORKDIR_NAME, false);
- err = PTR_ERR(workdir);
if (IS_ERR_OR_NULL(workdir))
+ err = PTR_ERR(workdir);
goto out;
ofs->workdir = workdir;
@@ -1598,9 +1598,9 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
int err;
unsigned int i;
- err = -ENOMEM;
ofs->fs = kcalloc(numlower + 1, sizeof(struct ovl_sb), GFP_KERNEL);
if (ofs->fs == NULL)
+ err = -ENOMEM;
goto out;
/* idx/fsid 0 are reserved for upper fs even with lower only overlay */
@@ -1652,8 +1652,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
}
mnt = clone_private_mount(&stack[i]);
- err = PTR_ERR(mnt);
if (IS_ERR(mnt)) {
+ err = PTR_ERR(mnt);
pr_err("failed to clone lowerpath\n");
iput(trap);
goto out;
@@ -1729,7 +1729,6 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
if (!stack)
return ERR_PTR(-ENOMEM);
- err = -EINVAL;
for (i = 0; i < numlower; i++) {
err = ovl_lower_dir(lower, &stack[i], ofs, &sb->s_stack_depth);
if (err)
@@ -1738,10 +1737,10 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
lower = strchr(lower, '\0') + 1;
}
- err = -EINVAL;
sb->s_stack_depth++;
if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {
pr_err("maximum fs stacking depth exceeded\n");
+ err = -EINVAL;
goto out_err;
}
@@ -1749,9 +1748,9 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
if (err)
goto out_err;
- err = -ENOMEM;
oe = ovl_alloc_entry(numlower);
if (!oe)
+ err = -ENOMEM;
goto out_err;
for (i = 0; i < numlower; i++) {
@@ -1894,20 +1893,20 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
unsigned int numlower;
int err;
- err = -EIO;
if (WARN_ON(sb->s_user_ns != current_user_ns()))
+ err = -EIO;
goto out;
sb->s_d_op = &ovl_dentry_operations;
- err = -ENOMEM;
ofs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL);
if (!ofs)
+ err = -ENOMEM;
goto out;
- err = -ENOMEM;
ofs->creator_cred = cred = prepare_creds();
if (!cred)
+ err = -ENOMEM;
goto out_err;
/* Is there a reason anyone would want not to share whiteouts? */
@@ -1922,29 +1921,29 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (err)
goto out_err;
- err = -EINVAL;
if (!ofs->config.lowerdir) {
if (!silent)
pr_err("missing 'lowerdir'\n");
+ err = -EINVAL;
goto out_err;
}
- err = -ENOMEM;
splitlower = kstrdup(ofs->config.lowerdir, GFP_KERNEL);
if (!splitlower)
+ err = -ENOMEM;
goto out_err;
- err = -EINVAL;
numlower = ovl_split_lowerdirs(splitlower);
if (numlower > OVL_MAX_STACK) {
pr_err("too many lower directories, limit is %d\n",
OVL_MAX_STACK);
+ err = -EINVAL;
goto out_err;
}
- err = -ENOMEM;
layers = kcalloc(numlower + 1, sizeof(struct ovl_layer), GFP_KERNEL);
if (!layers)
+ err = -ENOMEM;
goto out_err;
ofs->layers = layers;
@@ -1969,9 +1968,9 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (ofs->config.upperdir) {
struct super_block *upper_sb;
- err = -EINVAL;
if (!ofs->config.workdir) {
pr_err("missing 'workdir'\n");
+ err = -EINVAL;
goto out_err;
}
@@ -2000,8 +1999,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
sb->s_time_gran = upper_sb->s_time_gran;
}
oe = ovl_get_lowerstack(sb, splitlower, numlower, ofs, layers);
- err = PTR_ERR(oe);
if (IS_ERR(oe))
+ err = PTR_ERR(oe);
goto out_err;
/* If the upper fs is nonexistent, we mark overlayfs r/o too */
@@ -2054,9 +2053,9 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
sb->s_flags |= SB_POSIXACL;
sb->s_iflags |= SB_I_SKIP_SYNC;
- err = -ENOMEM;
root_dentry = ovl_get_root(sb, upperpath.dentry, oe);
if (!root_dentry)
+ err = -ENOMEM;
goto out_free_oe;
mntput(upperpath.mnt);
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 923d66d131c1..4b9f09a274ae 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -851,8 +851,8 @@ static void ovl_cleanup_index(struct dentry *dentry)
inode_lock_nested(dir, I_MUTEX_PARENT);
index = ovl_lookup_upper(ofs, name.name, indexdir, name.len);
- err = PTR_ERR(index);
if (IS_ERR(index)) {
+ err = PTR_ERR(index);
index = NULL;
} else if (ovl_index_all(dentry->d_sb)) {
/* Whiteout orphan index to block future open by handle */
--
2.27.0
Hi wenjun93,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mszeredi-vfs/overlayfs-next]
[also build test WARNING on linus/master v6.3 next-20230505]
[cannot apply to mszeredi-vfs/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wenjun93/overlayfs-clean-error-handling/20230506-162258
base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git overlayfs-next
patch link: https://lore.kernel.org/r/20230506082111.1655980-1-gwj1235%40yeah.net
patch subject: [PATCH] overlayfs: clean error handling
config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230506/[email protected]/config)
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d5593461bec1095c3008da7403952420e637c01a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review wenjun93/overlayfs-clean-error-handling/20230506-162258
git checkout d5593461bec1095c3008da7403952420e637c01a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash fs/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
fs/overlayfs/super.c: In function 'ovl_workdir_create':
>> fs/overlayfs/super.c:804:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
804 | if (d_really_is_negative(work))
| ^~
fs/overlayfs/super.c:806:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
806 | goto out_dput;
| ^~~~
fs/overlayfs/super.c: In function 'ovl_check_rename_whiteout':
fs/overlayfs/super.c:1195:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1195 | if (IS_ERR(temp))
| ^~
fs/overlayfs/super.c:1197:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1197 | goto out_unlock;
| ^~~~
fs/overlayfs/super.c:1216:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1216 | if (IS_ERR(whiteout))
| ^~
fs/overlayfs/super.c:1218:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1218 | goto cleanup_temp;
| ^~~~
fs/overlayfs/super.c: In function 'ovl_make_workdir':
fs/overlayfs/super.c:1295:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1295 | if (IS_ERR_OR_NULL(workdir))
| ^~
fs/overlayfs/super.c:1297:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1297 | goto out;
| ^~~~
fs/overlayfs/super.c: In function 'ovl_get_layers':
fs/overlayfs/super.c:1610:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1610 | if (ofs->fs == NULL)
| ^~
fs/overlayfs/super.c:1612:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1612 | goto out;
| ^~~~
fs/overlayfs/super.c: In function 'ovl_get_lowerstack':
fs/overlayfs/super.c:1760:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1760 | if (!oe)
| ^~
fs/overlayfs/super.c:1762:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1762 | goto out_err;
| ^~~~
fs/overlayfs/super.c: In function 'ovl_fill_super':
fs/overlayfs/super.c:1904:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1904 | if (WARN_ON(sb->s_user_ns != current_user_ns()))
| ^~
fs/overlayfs/super.c:1906:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1906 | goto out;
| ^~~~
fs/overlayfs/super.c:1911:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1911 | if (!ofs)
| ^~
fs/overlayfs/super.c:1913:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1913 | goto out;
| ^~~~
fs/overlayfs/super.c:1916:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1916 | if (!cred)
| ^~
fs/overlayfs/super.c:1918:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1918 | goto out_err;
| ^~~~
fs/overlayfs/super.c:1940:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1940 | if (!splitlower)
| ^~
fs/overlayfs/super.c:1942:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1942 | goto out_err;
| ^~~~
fs/overlayfs/super.c:1953:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1953 | if (!layers)
| ^~
fs/overlayfs/super.c:1955:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1955 | goto out_err;
| ^~~~
fs/overlayfs/super.c:2010:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2010 | if (IS_ERR(oe))
| ^~
fs/overlayfs/super.c:2012:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2012 | goto out_err;
| ^~~~
fs/overlayfs/super.c:2065:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2065 | if (!root_dentry)
| ^~
fs/overlayfs/super.c:2067:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2067 | goto out_free_oe;
| ^~~~
--
fs/overlayfs/namei.c: In function 'ovl_verify_index':
>> fs/overlayfs/namei.c:536:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
536 | if (index->d_name.len < sizeof(struct ovl_fb)*2)
| ^~
fs/overlayfs/namei.c:538:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
538 | goto fail;
| ^~~~
fs/overlayfs/namei.c:542:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
542 | if (!fh)
| ^~
fs/overlayfs/namei.c:544:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
544 | goto fail;
| ^~~~
fs/overlayfs/namei.c:546:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
546 | if (hex2bin(fh->buf, index->d_name.name, len))
| ^~
fs/overlayfs/namei.c:548:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
548 | goto fail;
| ^~~~
fs/overlayfs/namei.c: In function 'ovl_lookup':
fs/overlayfs/namei.c:910:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
910 | if (!stack)
| ^~
fs/overlayfs/namei.c:912:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
912 | goto out_put_upper;
| ^~~~
fs/overlayfs/namei.c:1071:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1071 | if (!oe)
| ^~
fs/overlayfs/namei.c:1073:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1073 | goto out_put;
| ^~~~
fs/overlayfs/namei.c:1118:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1118 | if (IS_ERR(inode))
| ^~
fs/overlayfs/namei.c:1120:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1120 | goto out_free_oe;
| ^~~~
--
fs/overlayfs/dir.c: In function 'ovl_cleanup_and_whiteout':
>> fs/overlayfs/dir.c:118:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
118 | if (IS_ERR(whiteout))
| ^~
fs/overlayfs/dir.c:120:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
120 | return err;
| ^~~~~~
fs/overlayfs/dir.c: In function 'ovl_create_real':
fs/overlayfs/dir.c:179:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
179 | if (newdentry->d_inode)
| ^~
fs/overlayfs/dir.c:181:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
181 | goto out;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_create_upper':
fs/overlayfs/dir.c:339:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
339 | if (IS_ERR(newdentry))
| ^~
fs/overlayfs/dir.c:341:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
341 | goto out_unlock;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_clear_empty':
fs/overlayfs/dir.c:397:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
397 | if (IS_ERR(opaquedir))
| ^~
fs/overlayfs/dir.c:399:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
399 | goto out_unlock;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_create_over_whiteout':
fs/overlayfs/dir.c:476:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
476 | if (IS_ERR(upper))
| ^~
fs/overlayfs/dir.c:478:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
478 | goto out_unlock;
| ^~~~
fs/overlayfs/dir.c:480:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
480 | if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper)))
| ^~
fs/overlayfs/dir.c:482:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
482 | goto out_dput;
| ^~~~
fs/overlayfs/dir.c:485:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
485 | if (IS_ERR(newdentry))
| ^~
fs/overlayfs/dir.c:487:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
487 | goto out_dput;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_create_or_link':
fs/overlayfs/dir.c:581:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
581 | if (!override_cred)
| ^~
fs/overlayfs/dir.c:583:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
583 | goto out_revert_creds;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_create_object':
fs/overlayfs/dir.c:636:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
636 | if (!inode)
| ^~
fs/overlayfs/dir.c:638:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
638 | goto out_drop_write;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_remove_and_whiteout':
fs/overlayfs/dir.c:762:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
762 | if (IS_ERR(opaquedir))
| ^~
fs/overlayfs/dir.c:764:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
764 | goto out;
| ^~~~
fs/overlayfs/dir.c:773:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
773 | if (IS_ERR(upper))
| ^~
fs/overlayfs/dir.c:775:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
775 | goto out_unlock;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_remove_upper':
fs/overlayfs/dir.c:813:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
813 | if (IS_ERR(opaquedir))
| ^~
fs/overlayfs/dir.c:815:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
815 | goto out;
| ^~~~
fs/overlayfs/dir.c:821:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
821 | if (IS_ERR(upper))
| ^~
fs/overlayfs/dir.c:823:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
823 | goto out_unlock;
| ^~~~
fs/overlayfs/dir.c:825:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
825 | if ((opaquedir && upper != opaquedir) ||
| ^~
fs/overlayfs/dir.c:828:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
828 | goto out_dput_upper;
| ^~~~
fs/overlayfs/dir.c: In function 'ovl_rename':
fs/overlayfs/dir.c:1101:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1101 | if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE))
| ^~
fs/overlayfs/dir.c:1103:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1103 | goto out;
| ^~~~
fs/overlayfs/dir.c:1108:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1108 | if (!ovl_can_move(old) || (!overwrite && !ovl_can_move(new)))
--
fs/overlayfs/readdir.c: In function 'ovl_iterate':
>> fs/overlayfs/readdir.c:767:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
767 | if (IS_ERR(cache))
| ^~
fs/overlayfs/readdir.c:769:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
769 | goto out;
| ^~~~
--
fs/overlayfs/copy_up.c: In function 'ovl_create_index':
>> fs/overlayfs/copy_up.c:511:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
511 | if (IS_ERR(temp))
| ^~
fs/overlayfs/copy_up.c:513:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
513 | goto free_name;
| ^~~~
fs/overlayfs/copy_up.c: In function 'ovl_copy_up_workdir':
fs/overlayfs/copy_up.c:709:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
709 | if (lock_rename(c->workdir, c->destdir) != NULL)
| ^~
fs/overlayfs/copy_up.c:711:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
711 | goto unlock;
| ^~~~
fs/overlayfs/copy_up.c:720:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
720 | if (IS_ERR(temp))
| ^~
fs/overlayfs/copy_up.c:722:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
722 | goto unlock;
| ^~~~
fs/overlayfs/copy_up.c:745:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
745 | if (IS_ERR(upper))
| ^~
fs/overlayfs/copy_up.c:747:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
747 | goto cleanup;
| ^~~~
--
fs/overlayfs/export.c: In function 'ovl_lookup_real_one':
>> fs/overlayfs/export.c:383:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
383 | if (ovl_dentry_real_at(connected, layer->idx) != parent)
| ^~
fs/overlayfs/export.c:385:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
385 | goto fail;
| ^~~~
fs/overlayfs/export.c: In function 'ovl_lower_fh_to_d':
fs/overlayfs/export.c:719:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
719 | if (IS_ERR(inode))
| ^~
fs/overlayfs/export.c:721:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
721 | goto out_err;
| ^~~~
fs/overlayfs/export.c:744:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
744 | if (IS_ERR_OR_NULL(upper))
| ^~
fs/overlayfs/export.c:746:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
746 | goto out_err;
| ^~~~
fs/overlayfs/export.c: In function 'ovl_fh_to_dentry':
fs/overlayfs/export.c:813:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
813 | if (IS_ERR(fh))
| ^~
fs/overlayfs/export.c:815:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
815 | goto out_err;
| ^~~~
vim +/if +804 fs/overlayfs/super.c
e9be9d5e76e348 Miklos Szeredi 2014-10-24 761
ad204488d3046b Miklos Szeredi 2017-11-10 762 static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
6b8aa129dcbe0e Amir Goldstein 2017-06-21 763 const char *name, bool persist)
e9be9d5e76e348 Miklos Szeredi 2014-10-24 764 {
ad204488d3046b Miklos Szeredi 2017-11-10 765 struct inode *dir = ofs->workbasedir->d_inode;
08f4c7c86d4cf1 Miklos Szeredi 2020-06-04 766 struct vfsmount *mnt = ovl_upper_mnt(ofs);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 767 struct dentry *work;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 768 int err;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 769 bool retried = false;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 770
5955102c9984fa Al Viro 2016-01-22 771 inode_lock_nested(dir, I_MUTEX_PARENT);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 772 retry:
22f289ce1f8b10 Christian Brauner 2022-04-04 773 work = ovl_lookup_upper(ofs, name, ofs->workbasedir, strlen(name));
e9be9d5e76e348 Miklos Szeredi 2014-10-24 774
e9be9d5e76e348 Miklos Szeredi 2014-10-24 775 if (!IS_ERR(work)) {
c11b9fdd6a612f Miklos Szeredi 2016-09-01 776 struct iattr attr = {
c11b9fdd6a612f Miklos Szeredi 2016-09-01 777 .ia_valid = ATTR_MODE,
32a3d848eb91a2 Al Viro 2016-12-04 778 .ia_mode = S_IFDIR | 0,
c11b9fdd6a612f Miklos Szeredi 2016-09-01 779 };
e9be9d5e76e348 Miklos Szeredi 2014-10-24 780
e9be9d5e76e348 Miklos Szeredi 2014-10-24 781 if (work->d_inode) {
e9be9d5e76e348 Miklos Szeredi 2014-10-24 782 err = -EEXIST;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 783 if (retried)
e9be9d5e76e348 Miklos Szeredi 2014-10-24 784 goto out_dput;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 785
6b8aa129dcbe0e Amir Goldstein 2017-06-21 786 if (persist)
6b8aa129dcbe0e Amir Goldstein 2017-06-21 787 goto out_unlock;
6b8aa129dcbe0e Amir Goldstein 2017-06-21 788
e9be9d5e76e348 Miklos Szeredi 2014-10-24 789 retried = true;
576bb263450bbb Christian Brauner 2022-04-04 790 err = ovl_workdir_cleanup(ofs, dir, mnt, work, 0);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 791 dput(work);
235ce9ed96bc62 Amir Goldstein 2020-08-30 792 if (err == -EINVAL) {
235ce9ed96bc62 Amir Goldstein 2020-08-30 793 work = ERR_PTR(err);
235ce9ed96bc62 Amir Goldstein 2020-08-30 794 goto out_unlock;
235ce9ed96bc62 Amir Goldstein 2020-08-30 795 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 796 goto retry;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 797 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 798
576bb263450bbb Christian Brauner 2022-04-04 799 err = ovl_mkdir_real(ofs, dir, &work, attr.ia_mode);
1f5573cfe7a705 Miklos Szeredi 2021-11-04 800 if (err)
1f5573cfe7a705 Miklos Szeredi 2021-11-04 801 goto out_dput;
1f5573cfe7a705 Miklos Szeredi 2021-11-04 802
1f5573cfe7a705 Miklos Szeredi 2021-11-04 803 /* Weird filesystem returning with hashed negative (kernfs)? */
1f5573cfe7a705 Miklos Szeredi 2021-11-04 @804 if (d_really_is_negative(work))
d5593461bec109 wenjun93 2023-05-06 805 err = -EINVAL;
1f5573cfe7a705 Miklos Szeredi 2021-11-04 806 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 807
cb348edb6bef72 Miklos Szeredi 2016-10-04 808 /*
cb348edb6bef72 Miklos Szeredi 2016-10-04 809 * Try to remove POSIX ACL xattrs from workdir. We are good if:
cb348edb6bef72 Miklos Szeredi 2016-10-04 810 *
cb348edb6bef72 Miklos Szeredi 2016-10-04 811 * a) success (there was a POSIX ACL xattr and was removed)
cb348edb6bef72 Miklos Szeredi 2016-10-04 812 * b) -ENODATA (there was no POSIX ACL xattr)
cb348edb6bef72 Miklos Szeredi 2016-10-04 813 * c) -EOPNOTSUPP (POSIX ACL xattrs are not supported)
cb348edb6bef72 Miklos Szeredi 2016-10-04 814 *
cb348edb6bef72 Miklos Szeredi 2016-10-04 815 * There are various other error values that could effectively
cb348edb6bef72 Miklos Szeredi 2016-10-04 816 * mean that the xattr doesn't exist (e.g. -ERANGE is returned
cb348edb6bef72 Miklos Szeredi 2016-10-04 817 * if the xattr name is too long), but the set of filesystems
cb348edb6bef72 Miklos Szeredi 2016-10-04 818 * allowed as upper are limited to "normal" ones, where checking
cb348edb6bef72 Miklos Szeredi 2016-10-04 819 * for the above two errors is sufficient.
cb348edb6bef72 Miklos Szeredi 2016-10-04 820 */
31acceb97500dd Christian Brauner 2022-09-22 821 err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_DEFAULT);
e1ff3dd1ae52ce Miklos Szeredi 2016-09-05 822 if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 823 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 824
31acceb97500dd Christian Brauner 2022-09-22 825 err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_ACCESS);
e1ff3dd1ae52ce Miklos Szeredi 2016-09-05 826 if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 827 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 828
c11b9fdd6a612f Miklos Szeredi 2016-09-01 829 /* Clear any inherited mode bits */
c11b9fdd6a612f Miklos Szeredi 2016-09-01 830 inode_lock(work->d_inode);
a15506eac96fdb Christian Brauner 2022-04-04 831 err = ovl_do_notify_change(ofs, work, &attr);
c11b9fdd6a612f Miklos Szeredi 2016-09-01 832 inode_unlock(work->d_inode);
c11b9fdd6a612f Miklos Szeredi 2016-09-01 833 if (err)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 834 goto out_dput;
6b8aa129dcbe0e Amir Goldstein 2017-06-21 835 } else {
6b8aa129dcbe0e Amir Goldstein 2017-06-21 836 err = PTR_ERR(work);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 837 goto out_err;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 838 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 839 out_unlock:
6b8aa129dcbe0e Amir Goldstein 2017-06-21 840 inode_unlock(dir);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 841 return work;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 842
e9be9d5e76e348 Miklos Szeredi 2014-10-24 843 out_dput:
e9be9d5e76e348 Miklos Szeredi 2014-10-24 844 dput(work);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 845 out_err:
1bd0a3aea4357e lijiazi 2019-12-16 846 pr_warn("failed to create directory %s/%s (errno: %i); mounting read-only\n",
ad204488d3046b Miklos Szeredi 2017-11-10 847 ofs->config.workdir, name, -err);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 848 work = NULL;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 849 goto out_unlock;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 850 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 851
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Hi wenjun93,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mszeredi-vfs/overlayfs-next]
[also build test WARNING on linus/master v6.3 next-20230505]
[cannot apply to mszeredi-vfs/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/wenjun93/overlayfs-clean-error-handling/20230506-162258
base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git overlayfs-next
patch link: https://lore.kernel.org/r/20230506082111.1655980-1-gwj1235%40yeah.net
patch subject: [PATCH] overlayfs: clean error handling
config: i386-randconfig-a011-20230501 (https://download.01.org/0day-ci/archive/20230506/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d5593461bec1095c3008da7403952420e637c01a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review wenjun93/overlayfs-clean-error-handling/20230506-162258
git checkout d5593461bec1095c3008da7403952420e637c01a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/overlayfs/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> fs/overlayfs/super.c:806:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_dput;
^
fs/overlayfs/super.c:804:3: note: previous statement is here
if (d_really_is_negative(work))
^
fs/overlayfs/super.c:1197:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_unlock;
^
fs/overlayfs/super.c:1195:2: note: previous statement is here
if (IS_ERR(temp))
^
fs/overlayfs/super.c:1218:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto cleanup_temp;
^
fs/overlayfs/super.c:1216:2: note: previous statement is here
if (IS_ERR(whiteout))
^
>> fs/overlayfs/super.c:1195:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(temp))
^~~~~~~~~~~~
fs/overlayfs/super.c:1236:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/super.c:1195:2: note: remove the 'if' if its condition is always true
if (IS_ERR(temp))
^~~~~~~~~~~~~~~~~
fs/overlayfs/super.c:1190:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/super.c:1297:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/super.c:1295:2: note: previous statement is here
if (IS_ERR_OR_NULL(workdir))
^
fs/overlayfs/super.c:1612:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/super.c:1610:2: note: previous statement is here
if (ofs->fs == NULL)
^
fs/overlayfs/super.c:1610:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ofs->fs == NULL)
^~~~~~~~~~~~~~~
fs/overlayfs/super.c:1719:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/super.c:1610:2: note: remove the 'if' if its condition is always true
if (ofs->fs == NULL)
^~~~~~~~~~~~~~~~~~~~
fs/overlayfs/super.c:1606:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/super.c:1762:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_err;
^
fs/overlayfs/super.c:1760:2: note: previous statement is here
if (!oe)
^
fs/overlayfs/super.c:1906:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/super.c:1904:2: note: previous statement is here
if (WARN_ON(sb->s_user_ns != current_user_ns()))
^
fs/overlayfs/super.c:1913:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/super.c:1911:2: note: previous statement is here
if (!ofs)
^
fs/overlayfs/super.c:1918:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_err;
^
fs/overlayfs/super.c:1916:2: note: previous statement is here
if (!cred)
^
fs/overlayfs/super.c:1942:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_err;
^
fs/overlayfs/super.c:1940:2: note: previous statement is here
if (!splitlower)
^
fs/overlayfs/super.c:1955:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_err;
^
fs/overlayfs/super.c:1953:2: note: previous statement is here
if (!layers)
^
fs/overlayfs/super.c:2012:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_err;
^
fs/overlayfs/super.c:2010:2: note: previous statement is here
if (IS_ERR(oe))
^
fs/overlayfs/super.c:2067:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_free_oe;
^
fs/overlayfs/super.c:2065:2: note: previous statement is here
if (!root_dentry)
^
fs/overlayfs/super.c:1904:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (WARN_ON(sb->s_user_ns != current_user_ns()))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:121:28: note: expanded from macro 'WARN_ON'
#define WARN_ON(condition) ({ \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/super.c:2084:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/super.c:1904:2: note: remove the 'if' if its condition is always true
if (WARN_ON(sb->s_user_ns != current_user_ns()))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/super.c:1902:9: note: initialize the variable 'err' to silence this warning
int err;
^
--
>> fs/overlayfs/namei.c:538:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto fail;
^
fs/overlayfs/namei.c:536:2: note: previous statement is here
if (index->d_name.len < sizeof(struct ovl_fb)*2)
^
fs/overlayfs/namei.c:544:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto fail;
^
fs/overlayfs/namei.c:542:2: note: previous statement is here
if (!fh)
^
fs/overlayfs/namei.c:548:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto fail;
^
fs/overlayfs/namei.c:546:2: note: previous statement is here
if (hex2bin(fh->buf, index->d_name.name, len))
^
>> fs/overlayfs/namei.c:536:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (index->d_name.len < sizeof(struct ovl_fb)*2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/namei.c:610:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/namei.c:536:2: note: remove the 'if' if its condition is always true
if (index->d_name.len < sizeof(struct ovl_fb)*2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/namei.c:531:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/namei.c:912:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_put_upper;
^
fs/overlayfs/namei.c:910:3: note: previous statement is here
if (!stack)
^
fs/overlayfs/namei.c:1073:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_put;
^
fs/overlayfs/namei.c:1071:2: note: previous statement is here
if (!oe)
^
fs/overlayfs/namei.c:1120:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_free_oe;
^
fs/overlayfs/namei.c:1118:3: note: previous statement is here
if (IS_ERR(inode))
^
7 warnings generated.
--
>> fs/overlayfs/dir.c:120:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return err;
^
fs/overlayfs/dir.c:118:2: note: previous statement is here
if (IS_ERR(whiteout))
^
>> fs/overlayfs/dir.c:118:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(whiteout))
^~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:120:10: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/dir.c:118:2: note: remove the 'if' if its condition is always true
if (IS_ERR(whiteout))
^~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:114:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/dir.c:181:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/dir.c:179:2: note: previous statement is here
if (newdentry->d_inode)
^
fs/overlayfs/dir.c:179:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (newdentry->d_inode)
^~~~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:220:6: note: uninitialized use occurs here
if (err) {
^~~
fs/overlayfs/dir.c:179:2: note: remove the 'if' if its condition is always true
if (newdentry->d_inode)
^~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:174:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/dir.c:341:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_unlock;
^
fs/overlayfs/dir.c:339:2: note: previous statement is here
if (IS_ERR(newdentry))
^
fs/overlayfs/dir.c:339:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(newdentry))
^~~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:354:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/dir.c:339:2: note: remove the 'if' if its condition is always true
if (IS_ERR(newdentry))
^~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/dir.c:329:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
fs/overlayfs/dir.c:399:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_unlock;
^
fs/overlayfs/dir.c:397:2: note: previous statement is here
if (IS_ERR(opaquedir))
^
fs/overlayfs/dir.c:478:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_unlock;
^
fs/overlayfs/dir.c:476:2: note: previous statement is here
if (IS_ERR(upper))
^
fs/overlayfs/dir.c:482:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_dput;
^
fs/overlayfs/dir.c:480:2: note: previous statement is here
if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper)))
^
fs/overlayfs/dir.c:487:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_dput;
^
fs/overlayfs/dir.c:485:2: note: previous statement is here
if (IS_ERR(newdentry))
^
fs/overlayfs/dir.c:583:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_revert_creds;
^
fs/overlayfs/dir.c:581:3: note: previous statement is here
if (!override_cred)
^
fs/overlayfs/dir.c:638:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_drop_write;
^
fs/overlayfs/dir.c:636:2: note: previous statement is here
if (!inode)
^
fs/overlayfs/dir.c:764:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/dir.c:762:3: note: previous statement is here
if (IS_ERR(opaquedir))
^
fs/overlayfs/dir.c:775:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out_unlock;
^
fs/overlayfs/dir.c:773:2: note: previous statement is here
if (IS_ERR(upper))
^
fs/overlayfs/dir.c:762:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(opaquedir))
--
>> fs/overlayfs/readdir.c:769:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto out;
^
fs/overlayfs/readdir.c:767:3: note: previous statement is here
if (IS_ERR(cache))
^
>> fs/overlayfs/readdir.c:767:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(cache))
^~~~~~~~~~~~~
fs/overlayfs/readdir.c:795:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/readdir.c:767:3: note: remove the 'if' if its condition is always true
if (IS_ERR(cache))
^~~~~~~~~~~~~~~~~~
fs/overlayfs/readdir.c:740:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
2 warnings generated.
--
>> fs/overlayfs/copy_up.c:513:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto free_name;
^
fs/overlayfs/copy_up.c:511:2: note: previous statement is here
if (IS_ERR(temp))
^
fs/overlayfs/copy_up.c:711:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto unlock;
^
fs/overlayfs/copy_up.c:709:2: note: previous statement is here
if (lock_rename(c->workdir, c->destdir) != NULL)
^
fs/overlayfs/copy_up.c:722:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto unlock;
^
fs/overlayfs/copy_up.c:720:2: note: previous statement is here
if (IS_ERR(temp))
^
fs/overlayfs/copy_up.c:747:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
goto cleanup;
^
fs/overlayfs/copy_up.c:745:2: note: previous statement is here
if (IS_ERR(upper))
^
>> fs/overlayfs/copy_up.c:709:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (lock_rename(c->workdir, c->destdir) != NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/copy_up.c:763:9: note: uninitialized use occurs here
return err;
^~~
fs/overlayfs/copy_up.c:709:2: note: remove the 'if' if its condition is always true
if (lock_rename(c->workdir, c->destdir) != NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/overlayfs/copy_up.c:700:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
5 warnings generated.
..
vim +/if +806 fs/overlayfs/super.c
e9be9d5e76e348 Miklos Szeredi 2014-10-24 761
ad204488d3046b Miklos Szeredi 2017-11-10 762 static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
6b8aa129dcbe0e Amir Goldstein 2017-06-21 763 const char *name, bool persist)
e9be9d5e76e348 Miklos Szeredi 2014-10-24 764 {
ad204488d3046b Miklos Szeredi 2017-11-10 765 struct inode *dir = ofs->workbasedir->d_inode;
08f4c7c86d4cf1 Miklos Szeredi 2020-06-04 766 struct vfsmount *mnt = ovl_upper_mnt(ofs);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 767 struct dentry *work;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 768 int err;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 769 bool retried = false;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 770
5955102c9984fa Al Viro 2016-01-22 771 inode_lock_nested(dir, I_MUTEX_PARENT);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 772 retry:
22f289ce1f8b10 Christian Brauner 2022-04-04 773 work = ovl_lookup_upper(ofs, name, ofs->workbasedir, strlen(name));
e9be9d5e76e348 Miklos Szeredi 2014-10-24 774
e9be9d5e76e348 Miklos Szeredi 2014-10-24 775 if (!IS_ERR(work)) {
c11b9fdd6a612f Miklos Szeredi 2016-09-01 776 struct iattr attr = {
c11b9fdd6a612f Miklos Szeredi 2016-09-01 777 .ia_valid = ATTR_MODE,
32a3d848eb91a2 Al Viro 2016-12-04 778 .ia_mode = S_IFDIR | 0,
c11b9fdd6a612f Miklos Szeredi 2016-09-01 779 };
e9be9d5e76e348 Miklos Szeredi 2014-10-24 780
e9be9d5e76e348 Miklos Szeredi 2014-10-24 781 if (work->d_inode) {
e9be9d5e76e348 Miklos Szeredi 2014-10-24 782 err = -EEXIST;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 783 if (retried)
e9be9d5e76e348 Miklos Szeredi 2014-10-24 784 goto out_dput;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 785
6b8aa129dcbe0e Amir Goldstein 2017-06-21 786 if (persist)
6b8aa129dcbe0e Amir Goldstein 2017-06-21 787 goto out_unlock;
6b8aa129dcbe0e Amir Goldstein 2017-06-21 788
e9be9d5e76e348 Miklos Szeredi 2014-10-24 789 retried = true;
576bb263450bbb Christian Brauner 2022-04-04 790 err = ovl_workdir_cleanup(ofs, dir, mnt, work, 0);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 791 dput(work);
235ce9ed96bc62 Amir Goldstein 2020-08-30 792 if (err == -EINVAL) {
235ce9ed96bc62 Amir Goldstein 2020-08-30 793 work = ERR_PTR(err);
235ce9ed96bc62 Amir Goldstein 2020-08-30 794 goto out_unlock;
235ce9ed96bc62 Amir Goldstein 2020-08-30 795 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 796 goto retry;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 797 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 798
576bb263450bbb Christian Brauner 2022-04-04 799 err = ovl_mkdir_real(ofs, dir, &work, attr.ia_mode);
1f5573cfe7a705 Miklos Szeredi 2021-11-04 800 if (err)
1f5573cfe7a705 Miklos Szeredi 2021-11-04 801 goto out_dput;
1f5573cfe7a705 Miklos Szeredi 2021-11-04 802
1f5573cfe7a705 Miklos Szeredi 2021-11-04 803 /* Weird filesystem returning with hashed negative (kernfs)? */
1f5573cfe7a705 Miklos Szeredi 2021-11-04 804 if (d_really_is_negative(work))
d5593461bec109 wenjun93 2023-05-06 805 err = -EINVAL;
1f5573cfe7a705 Miklos Szeredi 2021-11-04 @806 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 807
cb348edb6bef72 Miklos Szeredi 2016-10-04 808 /*
cb348edb6bef72 Miklos Szeredi 2016-10-04 809 * Try to remove POSIX ACL xattrs from workdir. We are good if:
cb348edb6bef72 Miklos Szeredi 2016-10-04 810 *
cb348edb6bef72 Miklos Szeredi 2016-10-04 811 * a) success (there was a POSIX ACL xattr and was removed)
cb348edb6bef72 Miklos Szeredi 2016-10-04 812 * b) -ENODATA (there was no POSIX ACL xattr)
cb348edb6bef72 Miklos Szeredi 2016-10-04 813 * c) -EOPNOTSUPP (POSIX ACL xattrs are not supported)
cb348edb6bef72 Miklos Szeredi 2016-10-04 814 *
cb348edb6bef72 Miklos Szeredi 2016-10-04 815 * There are various other error values that could effectively
cb348edb6bef72 Miklos Szeredi 2016-10-04 816 * mean that the xattr doesn't exist (e.g. -ERANGE is returned
cb348edb6bef72 Miklos Szeredi 2016-10-04 817 * if the xattr name is too long), but the set of filesystems
cb348edb6bef72 Miklos Szeredi 2016-10-04 818 * allowed as upper are limited to "normal" ones, where checking
cb348edb6bef72 Miklos Szeredi 2016-10-04 819 * for the above two errors is sufficient.
cb348edb6bef72 Miklos Szeredi 2016-10-04 820 */
31acceb97500dd Christian Brauner 2022-09-22 821 err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_DEFAULT);
e1ff3dd1ae52ce Miklos Szeredi 2016-09-05 822 if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 823 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 824
31acceb97500dd Christian Brauner 2022-09-22 825 err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_ACCESS);
e1ff3dd1ae52ce Miklos Szeredi 2016-09-05 826 if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 827 goto out_dput;
c11b9fdd6a612f Miklos Szeredi 2016-09-01 828
c11b9fdd6a612f Miklos Szeredi 2016-09-01 829 /* Clear any inherited mode bits */
c11b9fdd6a612f Miklos Szeredi 2016-09-01 830 inode_lock(work->d_inode);
a15506eac96fdb Christian Brauner 2022-04-04 831 err = ovl_do_notify_change(ofs, work, &attr);
c11b9fdd6a612f Miklos Szeredi 2016-09-01 832 inode_unlock(work->d_inode);
c11b9fdd6a612f Miklos Szeredi 2016-09-01 833 if (err)
c11b9fdd6a612f Miklos Szeredi 2016-09-01 834 goto out_dput;
6b8aa129dcbe0e Amir Goldstein 2017-06-21 835 } else {
6b8aa129dcbe0e Amir Goldstein 2017-06-21 836 err = PTR_ERR(work);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 837 goto out_err;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 838 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 839 out_unlock:
6b8aa129dcbe0e Amir Goldstein 2017-06-21 840 inode_unlock(dir);
e9be9d5e76e348 Miklos Szeredi 2014-10-24 841 return work;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 842
e9be9d5e76e348 Miklos Szeredi 2014-10-24 843 out_dput:
e9be9d5e76e348 Miklos Szeredi 2014-10-24 844 dput(work);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 845 out_err:
1bd0a3aea4357e lijiazi 2019-12-16 846 pr_warn("failed to create directory %s/%s (errno: %i); mounting read-only\n",
ad204488d3046b Miklos Szeredi 2017-11-10 847 ofs->config.workdir, name, -err);
6b8aa129dcbe0e Amir Goldstein 2017-06-21 848 work = NULL;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 849 goto out_unlock;
e9be9d5e76e348 Miklos Szeredi 2014-10-24 850 }
e9be9d5e76e348 Miklos Szeredi 2014-10-24 851
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests