All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 09/12] ovl: whiteout locking changes
@ 2025-06-28  4:47 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-06-28  4:47 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250624230636.3233059-10-neil@brown.name>
References: <20250624230636.3233059-10-neil@brown.name>
TO: NeilBrown <neil@brown.name>
TO: Miklos Szeredi <miklos@szeredi.hu>
TO: Amir Goldstein <amir73il@gmail.com>
CC: linux-unionfs@vger.kernel.org
CC: Alexander Viro <viro@zeniv.linux.org.uk>
CC: Christian Brauner <brauner@kernel.org>
CC: Jan Kara <jack@suse.cz>
CC: linux-fsdevel@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 next-20250627]
[cannot apply to mszeredi-vfs/overlayfs-next mszeredi-vfs/next linus/master v6.16-rc3]
[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/ovl-use-is_subdir-for-testing-if-one-thing-is-a-subdir-of-another/20250625-070919
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link:    https://lore.kernel.org/r/20250624230636.3233059-10-neil%40brown.name
patch subject: [PATCH 09/12] ovl: whiteout locking changes
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-161-20250627 (https://download.01.org/0day-ci/archive/20250628/202506281246.X6htntN7-lkp@intel.com/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)

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/202506281246.X6htntN7-lkp@intel.com/

New smatch warnings:
fs/overlayfs/dir.c:118 ovl_whiteout() error: uninitialized symbol 'err'.

Old smatch warnings:
fs/overlayfs/dir.c:58 ovl_cleanup_unlocked() error: uninitialized symbol 'err'.
fs/overlayfs/dir.c:437 ovl_clear_empty() warn: passing zero to 'ERR_PTR'

vim +/err +118 fs/overlayfs/dir.c

e9be9d5e76e348 Miklos Szeredi    2014-10-24   79  
c21c839b8448dd Chengguang Xu     2020-04-24   80  static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
e9be9d5e76e348 Miklos Szeredi    2014-10-24   81  {
e9be9d5e76e348 Miklos Szeredi    2014-10-24   82  	int err;
e9be9d5e76e348 Miklos Szeredi    2014-10-24   83  	struct dentry *whiteout;
c21c839b8448dd Chengguang Xu     2020-04-24   84  	struct dentry *workdir = ofs->workdir;
e9be9d5e76e348 Miklos Szeredi    2014-10-24   85  	struct inode *wdir = workdir->d_inode;
e9be9d5e76e348 Miklos Szeredi    2014-10-24   86  
a33c6f65a2ab05 NeilBrown         2025-06-25   87  	mutex_lock(&ofs->whiteout_lock);
c21c839b8448dd Chengguang Xu     2020-04-24   88  	if (!ofs->whiteout) {
a33c6f65a2ab05 NeilBrown         2025-06-25   89  		inode_lock(wdir);
576bb263450bbb Christian Brauner 2022-04-04   90  		whiteout = ovl_lookup_temp(ofs, workdir);
a33c6f65a2ab05 NeilBrown         2025-06-25   91  		if (!IS_ERR(whiteout)) {
576bb263450bbb Christian Brauner 2022-04-04   92  			err = ovl_do_whiteout(ofs, wdir, whiteout);
e9be9d5e76e348 Miklos Szeredi    2014-10-24   93  			if (err) {
e9be9d5e76e348 Miklos Szeredi    2014-10-24   94  				dput(whiteout);
e9be9d5e76e348 Miklos Szeredi    2014-10-24   95  				whiteout = ERR_PTR(err);
c21c839b8448dd Chengguang Xu     2020-04-24   96  			}
a33c6f65a2ab05 NeilBrown         2025-06-25   97  		}
a33c6f65a2ab05 NeilBrown         2025-06-25   98  		inode_unlock(wdir);
a33c6f65a2ab05 NeilBrown         2025-06-25   99  		if (IS_ERR(whiteout))
a33c6f65a2ab05 NeilBrown         2025-06-25  100  			goto out;
c21c839b8448dd Chengguang Xu     2020-04-24  101  		ofs->whiteout = whiteout;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  102  	}
e9be9d5e76e348 Miklos Szeredi    2014-10-24  103  
e4599d4b1aeff0 Amir Goldstein    2023-06-17  104  	if (!ofs->no_shared_whiteout) {
a33c6f65a2ab05 NeilBrown         2025-06-25  105  		inode_lock(wdir);
576bb263450bbb Christian Brauner 2022-04-04  106  		whiteout = ovl_lookup_temp(ofs, workdir);
a33c6f65a2ab05 NeilBrown         2025-06-25  107  		if (!IS_ERR(whiteout)) {
576bb263450bbb Christian Brauner 2022-04-04  108  			err = ovl_do_link(ofs, ofs->whiteout, wdir, whiteout);
a33c6f65a2ab05 NeilBrown         2025-06-25  109  			if (err) {
a33c6f65a2ab05 NeilBrown         2025-06-25  110  				dput(whiteout);
a33c6f65a2ab05 NeilBrown         2025-06-25  111  				whiteout = ERR_PTR(err);
a33c6f65a2ab05 NeilBrown         2025-06-25  112  			}
a33c6f65a2ab05 NeilBrown         2025-06-25  113  		}
a33c6f65a2ab05 NeilBrown         2025-06-25  114  		inode_unlock(wdir);
a33c6f65a2ab05 NeilBrown         2025-06-25  115  		if (!IS_ERR(whiteout) || PTR_ERR(whiteout) != -EMLINK)
c21c839b8448dd Chengguang Xu     2020-04-24  116  			goto out;
c21c839b8448dd Chengguang Xu     2020-04-24  117  
c21c839b8448dd Chengguang Xu     2020-04-24 @118  		pr_warn("Failed to link whiteout - disabling whiteout inode sharing(nlink=%u, err=%i)\n",
c21c839b8448dd Chengguang Xu     2020-04-24  119  			ofs->whiteout->d_inode->i_nlink, err);
e4599d4b1aeff0 Amir Goldstein    2023-06-17  120  		ofs->no_shared_whiteout = true;
c21c839b8448dd Chengguang Xu     2020-04-24  121  	}
c21c839b8448dd Chengguang Xu     2020-04-24  122  	whiteout = ofs->whiteout;
c21c839b8448dd Chengguang Xu     2020-04-24  123  	ofs->whiteout = NULL;
c21c839b8448dd Chengguang Xu     2020-04-24  124  out:
a33c6f65a2ab05 NeilBrown         2025-06-25  125  	mutex_unlock(&ofs->whiteout_lock);
e9be9d5e76e348 Miklos Szeredi    2014-10-24  126  	return whiteout;
e9be9d5e76e348 Miklos Szeredi    2014-10-24  127  }
e9be9d5e76e348 Miklos Szeredi    2014-10-24  128  

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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 00/12] ovl: narrow regions protected by directory i_rw_sem
@ 2025-06-24 22:54 NeilBrown
  2025-06-24 22:55 ` [PATCH 09/12] ovl: whiteout locking changes NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2025-06-24 22:54 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein
  Cc: linux-unionfs, Alexander Viro, Christian Brauner, Jan Kara,
	linux-fsdevel

This series of patches for overlayfs is primarily focussed on preparing
for some proposed changes to directory locking.  In the new scheme we
wil lock individual dentries in a directory rather than the whole
directory.

ovl currently will sometimes lock a directory on the upper filesystem
and do a few different things while holding the lock.  This is
incompatible with the new scheme.

This series narrows the region of code protected by the directory lock,
taking it multiple times when necessary.  This theoretically open up the
possibilty of other changes happening on the upper filesytem between the
unlock and the lock.  To some extent the patches guard against that by
checking the dentries still have the expect parent after retaking the
lock.  In general, I think ovl would have trouble if upperfs were being
changed independantly, and I don't think the changes here increase the
problem in any important way.

The first patch in this series doesn't exactly match the above, but it
does relate to directory locking and I think it is a sensible
simplificaiton.

I have tested this with fstests, both generic and unionfs tests.  I
wouldn't be surprised if I missed something though, so please review
carefully.

After this series (with any needed changes) lands I will resubmit my
change to vfs_rmdir() behaviour to have it drop the lock on error.  ovl
will be much better positioned to handle that change.  It will come with
the new "lookup_and_lock" API that I am proposing.

Thanks,
NeilBrown

 [PATCH 01/12] ovl: use is_subdir() for testing if one thing is a
 [PATCH 02/12] ovl: Call ovl_create_temp() and ovl_create_index()
 [PATCH 03/12] ovl: narrow the locked region in ovl_copy_up_workdir()
 [PATCH 04/12] ovl: narrow locking in ovl_create_upper()
 [PATCH 05/12] ovl: narrow locking in ovl_clear_empty()
 [PATCH 06/12] ovl: narrow locking in ovl_create_over_whiteout()
 [PATCH 07/12] ovl: narrow locking in ovl_rename()
 [PATCH 08/12] ovl: narrow locking in ovl_cleanup_whiteouts()
 [PATCH 09/12] ovl: whiteout locking changes
 [PATCH 10/12] ovl: narrow locking in ovl_check_rename_whiteout()
 [PATCH 11/12] ovl: change ovl_create_real() to receive dentry parent
 [PATCH 12/12] ovl: rename ovl_cleanup_unlocked() to ovl_cleanup()

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

end of thread, other threads:[~2025-07-02  2:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28  4:47 [PATCH 09/12] ovl: whiteout locking changes kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-06-24 22:54 [PATCH 00/12] ovl: narrow regions protected by directory i_rw_sem NeilBrown
2025-06-24 22:55 ` [PATCH 09/12] ovl: whiteout locking changes NeilBrown
2025-06-25 18:54   ` Amir Goldstein
2025-07-02  2:21     ` NeilBrown

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.