tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.rename head: 450e4154067593d27f3bf7e4a19206e00e40b5e6 commit: 450e4154067593d27f3bf7e4a19206e00e40b5e6 [10/10] rename(): avoid a deadlock in the case of parents having no common ancestor reproduce: (https://download.01.org/0day-ci/archive/20231122/202311220106.QLlI24Qn-lkp@xxxxxxxxx/reproduce) 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@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202311220106.QLlI24Qn-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): >> Documentation/filesystems/directory-locking.rst:33: WARNING: Enumerated list ends without a blank line; unexpected unindent. >> Documentation/filesystems/directory-locking.rst:46: WARNING: Unexpected indentation. >> Documentation/filesystems/directory-locking.rst:47: WARNING: Block quote ends without a blank line; unexpected unindent. >> Documentation/filesystems/directory-locking.rst:61: WARNING: Definition list ends without a blank line; unexpected unindent. vim +33 Documentation/filesystems/directory-locking.rst 27 28 4) link creation. Locking rules: 29 * lock the parent 30 * check that the source is not a directory 31 * lock the source 32 * call the method. > 33 All locks are exclusive. 34 35 5) rename() that is _not_ cross-directory. Locking rules: 36 * lock the parent 37 * find the source and target. 38 * decide which of the source and target need to be locked. 39 The source needs to be locked if it's a non-directory, target - if it's 40 a non-directory or about to be removed. Take the locks that need to be 41 taken, in inode pointer order if need to take both (that can happen only 42 when both source and target are non-directories - the source because 43 it wouldn't need to be locked otherwise and the target because mixing 44 directory and non-directory is allowed only with RENAME_EXCHANGE, and 45 that won't be removing the target). > 46 * call the method. > 47 All locks are exclusive. 48 49 6) cross-directory rename. The trickiest in the whole bunch. Locking 50 rules: 51 * lock the filesystem 52 * if the parents don't have a common ancestor, fail the operation. 53 * lock the parents in "ancestors first" order. If neither is an 54 ancestor of the other, lock the parent of source first. 55 * find the source and target. 56 * verify that the source is not a descendent of the target and 57 target is not a descendent of source; fail the operation otherwise. 58 * lock the subdirectories involved (source before target). 59 * lock the non-directories involved, in inode pointer order. 60 * call the method. > 61 All ->i_rwsem are taken exclusive. 62 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki