linux/fs/configfs
Louis Rilling b3e76af874 configfs: Fix deadlock with racing rmdir() and rename()
This patch fixes the deadlock between racing sys_rename() and configfs_rmdir().

The idea is to avoid locking i_mutexes of default groups in
configfs_detach_prep(), and rely instead on the new configfs_dirent_lock to
protect against configfs_dirent's linkage mutations. To ensure that an mkdir()
racing with rmdir() will not create new items in a to-be-removed default group,
we make configfs_new_dirent() check for the CONFIGFS_USET_DROPPING flag right
before linking the new dirent, and return error if the flag is set. This makes
racing mkdir()/symlink()/dir_open() fail in places where errors could already
happen, resp. in (attach_item()|attach_group())/create_link()/new_dirent().

configfs_depend() remains safe since it locks all the path from configfs root,
and is thus mutually exclusive with rmdir().

An advantage of this is that now detach_groups() unconditionnaly takes the
default groups i_mutex, which makes it more consistent with populate_groups().

Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
2008-07-14 13:57:16 -07:00
..
Makefile [PATCH] configfs: User-driven configuration filesystem 2006-01-03 11:45:28 -08:00
configfs_internal.h configfs: Introduce configfs_dirent_lock 2008-07-14 13:57:15 -07:00
dir.c configfs: Fix deadlock with racing rmdir() and rename() 2008-07-14 13:57:16 -07:00
file.c fs: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
inode.c configfs: Introduce configfs_dirent_lock 2008-07-14 13:57:15 -07:00
item.c [PATCH] configfs+dlm: Rename config_group_find_obj and state semantics clearly 2007-07-10 17:02:31 -07:00
mount.c fs: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
symlink.c configfs: Protect configfs_dirent s_links list mutations 2008-07-14 13:57:16 -07:00