All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Minor cleanup preparation for some dir-locking API changes
@ 2025-06-08 23:09 NeilBrown
  2025-06-08 23:09 ` [PATCH 1/5] VFS: merge lookup_one_qstr_excl_raw() back into lookup_one_qstr_excl() NeilBrown
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: NeilBrown @ 2025-06-08 23:09 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara, Chuck Lever,
	Jeff Layton, Amir Goldstein, Jan Harkes, David Howells,
	Tyler Hicks, Miklos Szeredi, Carlos Maiolino
  Cc: linux-fsdevel, coda, codalist, linux-nfs, netfs, ecryptfs,
	linux-unionfs, linux-xfs, linux-kernel

The following 5 patches provide further cleanup that serves as
preparation for some dir-locking API changes that I want to make.  The
most interesting is the last which makes another change to vfs_mkdir().
As well as returning the dentry or consuming it on failure (a recent
change) it now also unlocks on failure.  This will be needed when we
transition to locking just the dentry, not the whole directory.

This leaves some rather clumsy code in overlayfs.  Overlayfs sometimes
takes a rename lock (two directories) and then possibly does a
vfs_mkdir() in one of those directories.  When that fails we now need to
unlock only the other directory.

I hope to go through overlayfs to narrow the directory locking so each
lock only covers a single operation (possibly including a lookup first).
That should remove the clumsiness and will also be needed for the
proposed API change.

As well as the cleanups here I have a few for smb/server.  I will send
those separately as they deserve careful review by the smb team and I
don't want them to be buried in this patch set.

After these, and the mentioned overlayfs changes, I have a series which
adds a collection of APIs with names like "lookup_and_lock()" which
combine the locking and the lookup, and then a set which changes all
code which currently locks a directory for name-based operations to
instead use the new look_and_lock() interfaces.  This will mean that the
changes to directory locking can be done in one central place.

After that there are a few more cleanups to stop filesystems from usng
d_drop() in the middle of name operations (at the end is OK, but not in
the middle) and then the core patches for this work which introduce an
alternate way to provide all the locking that the VFS needs for name
operations without taking i_rw_sem.  Filesystems can then opt into using
only this locking and to not depend on i_rw_sem.  This allows create and
remove of different names is the same directory to continue concurrently
with each other and with renames.  Renames are also concurrent though
cross-directory renames block some other cross-directory renames in the
same part of the tree.

Note that i_rw_sem will still be used for the target of rmdir, and will
still be held as a shared lock by readdir() so that we never try reading
in a directory being removed.  It might still be used (shared) for
lookups for the same reason, though I haven't completely settled my
design there yet.

Thanks,
NeilBrown

 [PATCH 1/5] VFS: merge lookup_one_qstr_excl_raw() back into
 [PATCH 2/5] VFS: Minor fixes for porting.rst
 [PATCH 3/5] coda: use iterate_dir() in coda_readdir()
 [PATCH 4/5] exportfs: use lookup_one_unlocked()
 [PATCH 5/5] Change vfs_mkdir() to unlock on failure.

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] Change vfs_mkdir() to unlock on failure.
@ 2025-06-09 20:36 kernel test robot
  0 siblings, 0 replies; 27+ messages in thread
From: kernel test robot @ 2025-06-09 20:36 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250608230952.20539-6-neil@brown.name>
References: <20250608230952.20539-6-neil@brown.name>
TO: NeilBrown <neil@brown.name>
TO: Alexander Viro <viro@zeniv.linux.org.uk>
TO: Christian Brauner <brauner@kernel.org>
TO: Jan Kara <jack@suse.cz>
TO: Chuck Lever <chuck.lever@oracle.com>
TO: Jeff Layton <jlayton@kernel.org>
TO: Amir Goldstein <amir73il@gmail.com>
TO: Jan Harkes <jaharkes@cs.cmu.edu>
TO: David Howells <dhowells@redhat.com>
TO: Tyler Hicks <code@tyhicks.com>
TO: Miklos Szeredi <miklos@szeredi.hu>
TO: Carlos Maiolino <cem@kernel.org>
CC: linux-fsdevel@vger.kernel.org
CC: coda@cs.cmu.edu
CC: codalist@coda.cs.cmu.edu
CC: linux-nfs@vger.kernel.org
CC: netfs@lists.linux.dev
CC: ecryptfs@vger.kernel.org
CC: linux-unionfs@vger.kernel.org
CC: linux-xfs@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi NeilBrown,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.16-rc1 next-20250606]
[cannot apply to viro-vfs/for-next xfs-linux/for-next tyhicks-ecryptfs/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/NeilBrown/VFS-merge-lookup_one_qstr_excl_raw-back-into-lookup_one_qstr_excl/20250609-071214
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link:    https://lore.kernel.org/r/20250608230952.20539-6-neil%40brown.name
patch subject: [PATCH 5/5] Change vfs_mkdir() to unlock on failure.
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: csky-randconfig-r073-20250609 (https://download.01.org/0day-ci/archive/20250610/202506100421.GCkbRvUd-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 12.4.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202506100421.GCkbRvUd-lkp@intel.com/

smatch warnings:
fs/overlayfs/super.c:373 ovl_workdir_create() warn: 'work' is an error pointer or valid

vim +/work +373 fs/overlayfs/super.c

e9be9d5e76e348 Miklos Szeredi    2014-10-24  292  
ad204488d3046b Miklos Szeredi    2017-11-10  293  static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
6b8aa129dcbe0e Amir Goldstein    2017-06-21  294  					 const char *name, bool persist)
e9be9d5e76e348 Miklos Szeredi    2014-10-24  295  {
ad204488d3046b Miklos Szeredi    2017-11-10  296  	struct inode *dir =  ofs->workbasedir->d_inode;
08f4c7c86d4cf1 Miklos Szeredi    2020-06-04  297  	struct vfsmount *mnt = ovl_upper_mnt(ofs);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  298  	struct dentry *work;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  299  	int err;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  300  	bool retried = false;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  301  
5955102c9984fa Al Viro           2016-01-22  302  	inode_lock_nested(dir, I_MUTEX_PARENT);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  303  retry:
22f289ce1f8b10 Christian Brauner 2022-04-04  304  	work = ovl_lookup_upper(ofs, name, ofs->workbasedir, strlen(name));
e9be9d5e76e348 Miklos Szeredi    2014-10-24  305  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  306  	if (!IS_ERR(work)) {
c11b9fdd6a612f Miklos Szeredi    2016-09-01  307  		struct iattr attr = {
c11b9fdd6a612f Miklos Szeredi    2016-09-01  308  			.ia_valid = ATTR_MODE,
32a3d848eb91a2 Al Viro           2016-12-04  309  			.ia_mode = S_IFDIR | 0,
c11b9fdd6a612f Miklos Szeredi    2016-09-01  310  		};
e9be9d5e76e348 Miklos Szeredi    2014-10-24  311  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  312  		if (work->d_inode) {
e9be9d5e76e348 Miklos Szeredi    2014-10-24  313  			err = -EEXIST;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  314  			if (retried)
e9be9d5e76e348 Miklos Szeredi    2014-10-24  315  				goto out_dput;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  316  
6b8aa129dcbe0e Amir Goldstein    2017-06-21  317  			if (persist)
6b8aa129dcbe0e Amir Goldstein    2017-06-21  318  				goto out_unlock;
6b8aa129dcbe0e Amir Goldstein    2017-06-21  319  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  320  			retried = true;
576bb263450bbb Christian Brauner 2022-04-04  321  			err = ovl_workdir_cleanup(ofs, dir, mnt, work, 0);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  322  			dput(work);
235ce9ed96bc62 Amir Goldstein    2020-08-30  323  			if (err == -EINVAL) {
235ce9ed96bc62 Amir Goldstein    2020-08-30  324  				work = ERR_PTR(err);
235ce9ed96bc62 Amir Goldstein    2020-08-30  325  				goto out_unlock;
235ce9ed96bc62 Amir Goldstein    2020-08-30  326  			}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  327  			goto retry;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  328  		}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  329  
c54b386969a581 NeilBrown         2025-02-27  330  		work = ovl_do_mkdir(ofs, dir, work, attr.ia_mode);
c54b386969a581 NeilBrown         2025-02-27  331  		err = PTR_ERR(work);
c54b386969a581 NeilBrown         2025-02-27  332  		if (IS_ERR(work))
c54b386969a581 NeilBrown         2025-02-27  333  			goto out_err;
1f5573cfe7a705 Miklos Szeredi    2021-11-04  334  
1f5573cfe7a705 Miklos Szeredi    2021-11-04  335  		/* Weird filesystem returning with hashed negative (kernfs)? */
1f5573cfe7a705 Miklos Szeredi    2021-11-04  336  		err = -EINVAL;
1f5573cfe7a705 Miklos Szeredi    2021-11-04  337  		if (d_really_is_negative(work))
1f5573cfe7a705 Miklos Szeredi    2021-11-04  338  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  339  
cb348edb6bef72 Miklos Szeredi    2016-10-04  340  		/*
cb348edb6bef72 Miklos Szeredi    2016-10-04  341  		 * Try to remove POSIX ACL xattrs from workdir.  We are good if:
cb348edb6bef72 Miklos Szeredi    2016-10-04  342  		 *
cb348edb6bef72 Miklos Szeredi    2016-10-04  343  		 * a) success (there was a POSIX ACL xattr and was removed)
cb348edb6bef72 Miklos Szeredi    2016-10-04  344  		 * b) -ENODATA (there was no POSIX ACL xattr)
cb348edb6bef72 Miklos Szeredi    2016-10-04  345  		 * c) -EOPNOTSUPP (POSIX ACL xattrs are not supported)
cb348edb6bef72 Miklos Szeredi    2016-10-04  346  		 *
cb348edb6bef72 Miklos Szeredi    2016-10-04  347  		 * There are various other error values that could effectively
cb348edb6bef72 Miklos Szeredi    2016-10-04  348  		 * mean that the xattr doesn't exist (e.g. -ERANGE is returned
cb348edb6bef72 Miklos Szeredi    2016-10-04  349  		 * if the xattr name is too long), but the set of filesystems
cb348edb6bef72 Miklos Szeredi    2016-10-04  350  		 * allowed as upper are limited to "normal" ones, where checking
cb348edb6bef72 Miklos Szeredi    2016-10-04  351  		 * for the above two errors is sufficient.
cb348edb6bef72 Miklos Szeredi    2016-10-04  352  		 */
31acceb97500dd Christian Brauner 2022-09-22  353  		err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_DEFAULT);
e1ff3dd1ae52ce Miklos Szeredi    2016-09-05  354  		if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  355  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  356  
31acceb97500dd Christian Brauner 2022-09-22  357  		err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_ACCESS);
e1ff3dd1ae52ce Miklos Szeredi    2016-09-05  358  		if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  359  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  360  
c11b9fdd6a612f Miklos Szeredi    2016-09-01  361  		/* Clear any inherited mode bits */
c11b9fdd6a612f Miklos Szeredi    2016-09-01  362  		inode_lock(work->d_inode);
a15506eac96fdb Christian Brauner 2022-04-04  363  		err = ovl_do_notify_change(ofs, work, &attr);
c11b9fdd6a612f Miklos Szeredi    2016-09-01  364  		inode_unlock(work->d_inode);
c11b9fdd6a612f Miklos Szeredi    2016-09-01  365  		if (err)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  366  			goto out_dput;
6b8aa129dcbe0e Amir Goldstein    2017-06-21  367  	} else {
6b8aa129dcbe0e Amir Goldstein    2017-06-21  368  		err = PTR_ERR(work);
781b56fbc2cc93 NeilBrown         2025-06-09  369  		inode_unlock(dir);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  370  		goto out_err;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  371  	}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  372  out_unlock:
781b56fbc2cc93 NeilBrown         2025-06-09 @373  	if (work && !IS_ERR(work))
6b8aa129dcbe0e Amir Goldstein    2017-06-21  374  		inode_unlock(dir);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  375  	return work;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  376  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  377  out_dput:
e9be9d5e76e348 Miklos Szeredi    2014-10-24  378  	dput(work);
781b56fbc2cc93 NeilBrown         2025-06-09  379  	inode_unlock(dir);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  380  out_err:
1bd0a3aea4357e lijiazi           2019-12-16  381  	pr_warn("failed to create directory %s/%s (errno: %i); mounting read-only\n",
ad204488d3046b Miklos Szeredi    2017-11-10  382  		ofs->config.workdir, name, -err);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  383  	work = NULL;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  384  	goto out_unlock;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  385  }
e9be9d5e76e348 Miklos Szeredi    2014-10-24  386  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] Change vfs_mkdir() to unlock on failure.
@ 2025-06-10 13:40 kernel test robot
  0 siblings, 0 replies; 27+ messages in thread
From: kernel test robot @ 2025-06-10 13:40 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250608230952.20539-6-neil@brown.name>
References: <20250608230952.20539-6-neil@brown.name>
TO: NeilBrown <neil@brown.name>
TO: Alexander Viro <viro@zeniv.linux.org.uk>
TO: Christian Brauner <brauner@kernel.org>
TO: Jan Kara <jack@suse.cz>
TO: Chuck Lever <chuck.lever@oracle.com>
TO: Jeff Layton <jlayton@kernel.org>
TO: Amir Goldstein <amir73il@gmail.com>
TO: Jan Harkes <jaharkes@cs.cmu.edu>
TO: David Howells <dhowells@redhat.com>
TO: Tyler Hicks <code@tyhicks.com>
TO: Miklos Szeredi <miklos@szeredi.hu>
TO: Carlos Maiolino <cem@kernel.org>
CC: linux-fsdevel@vger.kernel.org
CC: coda@cs.cmu.edu
CC: codalist@coda.cs.cmu.edu
CC: linux-nfs@vger.kernel.org
CC: netfs@lists.linux.dev
CC: ecryptfs@vger.kernel.org
CC: linux-unionfs@vger.kernel.org
CC: linux-xfs@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi NeilBrown,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.16-rc1 next-20250610]
[cannot apply to viro-vfs/for-next xfs-linux/for-next tyhicks-ecryptfs/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/NeilBrown/VFS-merge-lookup_one_qstr_excl_raw-back-into-lookup_one_qstr_excl/20250609-071214
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link:    https://lore.kernel.org/r/20250608230952.20539-6-neil%40brown.name
patch subject: [PATCH 5/5] Change vfs_mkdir() to unlock on failure.
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20250610 (https://download.01.org/0day-ci/archive/20250610/202506102159.UekeQASb-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202506102159.UekeQASb-lkp@intel.com/

New smatch warnings:
fs/overlayfs/super.c:384 ovl_workdir_create() warn: inconsistent returns '&dir->i_rwsem'.
fs/overlayfs/super.c:614 ovl_check_rename_whiteout() warn: inconsistent returns '&dir->i_rwsem'.

Old smatch warnings:
fs/overlayfs/super.c:373 ovl_workdir_create() warn: 'work' is an error pointer or valid

vim +384 fs/overlayfs/super.c

e9be9d5e76e348 Miklos Szeredi    2014-10-24  292  
ad204488d3046b Miklos Szeredi    2017-11-10  293  static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
6b8aa129dcbe0e Amir Goldstein    2017-06-21  294  					 const char *name, bool persist)
e9be9d5e76e348 Miklos Szeredi    2014-10-24  295  {
ad204488d3046b Miklos Szeredi    2017-11-10  296  	struct inode *dir =  ofs->workbasedir->d_inode;
08f4c7c86d4cf1 Miklos Szeredi    2020-06-04  297  	struct vfsmount *mnt = ovl_upper_mnt(ofs);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  298  	struct dentry *work;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  299  	int err;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  300  	bool retried = false;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  301  
5955102c9984fa Al Viro           2016-01-22  302  	inode_lock_nested(dir, I_MUTEX_PARENT);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  303  retry:
22f289ce1f8b10 Christian Brauner 2022-04-04  304  	work = ovl_lookup_upper(ofs, name, ofs->workbasedir, strlen(name));
e9be9d5e76e348 Miklos Szeredi    2014-10-24  305  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  306  	if (!IS_ERR(work)) {
c11b9fdd6a612f Miklos Szeredi    2016-09-01  307  		struct iattr attr = {
c11b9fdd6a612f Miklos Szeredi    2016-09-01  308  			.ia_valid = ATTR_MODE,
32a3d848eb91a2 Al Viro           2016-12-04  309  			.ia_mode = S_IFDIR | 0,
c11b9fdd6a612f Miklos Szeredi    2016-09-01  310  		};
e9be9d5e76e348 Miklos Szeredi    2014-10-24  311  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  312  		if (work->d_inode) {
e9be9d5e76e348 Miklos Szeredi    2014-10-24  313  			err = -EEXIST;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  314  			if (retried)
e9be9d5e76e348 Miklos Szeredi    2014-10-24  315  				goto out_dput;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  316  
6b8aa129dcbe0e Amir Goldstein    2017-06-21  317  			if (persist)
6b8aa129dcbe0e Amir Goldstein    2017-06-21  318  				goto out_unlock;
6b8aa129dcbe0e Amir Goldstein    2017-06-21  319  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  320  			retried = true;
576bb263450bbb Christian Brauner 2022-04-04  321  			err = ovl_workdir_cleanup(ofs, dir, mnt, work, 0);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  322  			dput(work);
235ce9ed96bc62 Amir Goldstein    2020-08-30  323  			if (err == -EINVAL) {
235ce9ed96bc62 Amir Goldstein    2020-08-30  324  				work = ERR_PTR(err);
235ce9ed96bc62 Amir Goldstein    2020-08-30  325  				goto out_unlock;
235ce9ed96bc62 Amir Goldstein    2020-08-30  326  			}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  327  			goto retry;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  328  		}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  329  
c54b386969a581 NeilBrown         2025-02-27  330  		work = ovl_do_mkdir(ofs, dir, work, attr.ia_mode);
c54b386969a581 NeilBrown         2025-02-27  331  		err = PTR_ERR(work);
c54b386969a581 NeilBrown         2025-02-27  332  		if (IS_ERR(work))
c54b386969a581 NeilBrown         2025-02-27  333  			goto out_err;
1f5573cfe7a705 Miklos Szeredi    2021-11-04  334  
1f5573cfe7a705 Miklos Szeredi    2021-11-04  335  		/* Weird filesystem returning with hashed negative (kernfs)? */
1f5573cfe7a705 Miklos Szeredi    2021-11-04  336  		err = -EINVAL;
1f5573cfe7a705 Miklos Szeredi    2021-11-04  337  		if (d_really_is_negative(work))
1f5573cfe7a705 Miklos Szeredi    2021-11-04  338  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  339  
cb348edb6bef72 Miklos Szeredi    2016-10-04  340  		/*
cb348edb6bef72 Miklos Szeredi    2016-10-04  341  		 * Try to remove POSIX ACL xattrs from workdir.  We are good if:
cb348edb6bef72 Miklos Szeredi    2016-10-04  342  		 *
cb348edb6bef72 Miklos Szeredi    2016-10-04  343  		 * a) success (there was a POSIX ACL xattr and was removed)
cb348edb6bef72 Miklos Szeredi    2016-10-04  344  		 * b) -ENODATA (there was no POSIX ACL xattr)
cb348edb6bef72 Miklos Szeredi    2016-10-04  345  		 * c) -EOPNOTSUPP (POSIX ACL xattrs are not supported)
cb348edb6bef72 Miklos Szeredi    2016-10-04  346  		 *
cb348edb6bef72 Miklos Szeredi    2016-10-04  347  		 * There are various other error values that could effectively
cb348edb6bef72 Miklos Szeredi    2016-10-04  348  		 * mean that the xattr doesn't exist (e.g. -ERANGE is returned
cb348edb6bef72 Miklos Szeredi    2016-10-04  349  		 * if the xattr name is too long), but the set of filesystems
cb348edb6bef72 Miklos Szeredi    2016-10-04  350  		 * allowed as upper are limited to "normal" ones, where checking
cb348edb6bef72 Miklos Szeredi    2016-10-04  351  		 * for the above two errors is sufficient.
cb348edb6bef72 Miklos Szeredi    2016-10-04  352  		 */
31acceb97500dd Christian Brauner 2022-09-22  353  		err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_DEFAULT);
e1ff3dd1ae52ce Miklos Szeredi    2016-09-05  354  		if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  355  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  356  
31acceb97500dd Christian Brauner 2022-09-22  357  		err = ovl_do_remove_acl(ofs, work, XATTR_NAME_POSIX_ACL_ACCESS);
e1ff3dd1ae52ce Miklos Szeredi    2016-09-05  358  		if (err && err != -ENODATA && err != -EOPNOTSUPP)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  359  			goto out_dput;
c11b9fdd6a612f Miklos Szeredi    2016-09-01  360  
c11b9fdd6a612f Miklos Szeredi    2016-09-01  361  		/* Clear any inherited mode bits */
c11b9fdd6a612f Miklos Szeredi    2016-09-01  362  		inode_lock(work->d_inode);
a15506eac96fdb Christian Brauner 2022-04-04  363  		err = ovl_do_notify_change(ofs, work, &attr);
c11b9fdd6a612f Miklos Szeredi    2016-09-01  364  		inode_unlock(work->d_inode);
c11b9fdd6a612f Miklos Szeredi    2016-09-01  365  		if (err)
c11b9fdd6a612f Miklos Szeredi    2016-09-01  366  			goto out_dput;
6b8aa129dcbe0e Amir Goldstein    2017-06-21  367  	} else {
6b8aa129dcbe0e Amir Goldstein    2017-06-21  368  		err = PTR_ERR(work);
781b56fbc2cc93 NeilBrown         2025-06-09  369  		inode_unlock(dir);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  370  		goto out_err;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  371  	}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  372  out_unlock:
781b56fbc2cc93 NeilBrown         2025-06-09  373  	if (work && !IS_ERR(work))
6b8aa129dcbe0e Amir Goldstein    2017-06-21  374  		inode_unlock(dir);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  375  	return work;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  376  
e9be9d5e76e348 Miklos Szeredi    2014-10-24  377  out_dput:
e9be9d5e76e348 Miklos Szeredi    2014-10-24  378  	dput(work);
781b56fbc2cc93 NeilBrown         2025-06-09  379  	inode_unlock(dir);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  380  out_err:
1bd0a3aea4357e lijiazi           2019-12-16  381  	pr_warn("failed to create directory %s/%s (errno: %i); mounting read-only\n",
ad204488d3046b Miklos Szeredi    2017-11-10  382  		ofs->config.workdir, name, -err);
6b8aa129dcbe0e Amir Goldstein    2017-06-21  383  	work = NULL;
e9be9d5e76e348 Miklos Szeredi    2014-10-24 @384  	goto out_unlock;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  385  }
e9be9d5e76e348 Miklos Szeredi    2014-10-24  386  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2025-06-12  7:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-08 23:09 [PATCH 0/5] Minor cleanup preparation for some dir-locking API changes NeilBrown
2025-06-08 23:09 ` [PATCH 1/5] VFS: merge lookup_one_qstr_excl_raw() back into lookup_one_qstr_excl() NeilBrown
2025-06-09 12:13   ` Jeff Layton
2025-06-08 23:09 ` [PATCH 2/5] VFS: Minor fixes for porting.rst NeilBrown
2025-06-09 12:13   ` Jeff Layton
2025-06-08 23:09 ` [PATCH 3/5] coda: use iterate_dir() in coda_readdir() NeilBrown
2025-06-09 12:17   ` Jeff Layton
2025-06-09 13:00     ` Jan Kara
2025-06-09 13:12       ` Jan Harkes
2025-06-09 13:21         ` Jeff Layton
2025-06-09 13:33           ` Jan Harkes
2025-06-09 14:02             ` Jeff Layton
2025-06-09 14:35   ` Jan Harkes
2025-06-08 23:09 ` [PATCH 4/5] exportfs: use lookup_one_unlocked() NeilBrown
2025-06-09 12:18   ` Jeff Layton
2025-06-09 14:01   ` Chuck Lever
2025-06-08 23:09 ` [PATCH 5/5] Change vfs_mkdir() to unlock on failure NeilBrown
2025-06-09  0:50   ` Al Viro
2025-06-09  5:22     ` NeilBrown
2025-06-09  5:34       ` Al Viro
2025-06-10  8:26         ` Al Viro
2025-06-09 12:23   ` Jeff Layton
2025-06-12  6:59   ` Amir Goldstein
2025-06-11 11:43 ` [PATCH 0/5] Minor cleanup preparation for some dir-locking API changes Christian Brauner
2025-06-11 22:35   ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2025-06-09 20:36 [PATCH 5/5] Change vfs_mkdir() to unlock on failure kernel test robot
2025-06-10 13:40 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.