linux/fs/overlayfs
Al Viro a8b0026847 rename(): avoid a deadlock in the case of parents having no common ancestor
... and fix the directory locking documentation and proof of correctness.
Holding ->s_vfs_rename_mutex *almost* prevents ->d_parent changes; the
case where we really don't want it is splicing the root of disconnected
tree to somewhere.

In other words, ->s_vfs_rename_mutex is sufficient to stabilize "X is an
ancestor of Y" only if X and Y are already in the same tree.  Otherwise
it can go from false to true, and one can construct a deadlock on that.

Make lock_two_directories() report an error in such case and update the
callers of lock_rename()/lock_rename_child() to handle such errors.

And yes, such conditions are not impossible to create ;-/

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2023-11-25 02:54:14 -05:00
..
copy_up.c rename(): avoid a deadlock in the case of parents having no common ancestor 2023-11-25 02:54:14 -05:00
dir.c rename(): avoid a deadlock in the case of parents having no common ancestor 2023-11-25 02:54:14 -05:00
export.c ovl: reorder ovl_want_write() after ovl_inode_lock() 2023-10-31 00:12:57 +02:00
file.c ovl: add helper ovl_file_modified() 2023-10-31 00:12:55 +02:00
inode.c ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
Kconfig ovl: Kconfig: introduce CONFIG_OVERLAY_FS_DEBUG 2023-08-12 19:02:53 +03:00
Makefile ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
namei.c ovl: Add an alternative type of whiteout 2023-10-31 00:12:59 +02:00
overlayfs.h ovl: Add an alternative type of whiteout 2023-10-31 00:12:59 +02:00
ovl_entry.h ovl: make use of ->layers safe in rcu pathwalk 2023-10-02 17:45:02 +03:00
params.c ovl: add support for appending lowerdirs one by one 2023-10-31 00:13:02 +02:00
params.h ovl: store and show the user provided lowerdir mount option 2023-10-31 00:13:02 +02:00
readdir.c ovl: Add an alternative type of whiteout 2023-10-31 00:12:59 +02:00
super.c rename(): avoid a deadlock in the case of parents having no common ancestor 2023-11-25 02:54:14 -05:00
util.c rename(): avoid a deadlock in the case of parents having no common ancestor 2023-11-25 02:54:14 -05:00
xattrs.c ovl: Support escaped overlay.* xattrs 2023-10-31 00:12:59 +02:00