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
..
2008-07-03 09:59:03 -05:00
2008-02-08 09:22:40 -08:00
2008-05-01 08:04:01 -07:00
2008-04-29 08:06:04 -07:00
2008-05-19 15:37:27 -05:00
2008-04-29 08:06:00 -07:00
2008-04-30 08:29:52 -07:00
2008-02-08 09:22:40 -08:00
2008-05-21 16:55:58 -07:00
2008-04-29 08:06:18 -07:00
2008-07-08 15:22:40 -04:00
2007-10-18 14:37:31 -07:00
2008-05-24 09:56:08 -07:00
2008-04-30 08:29:52 -07:00
2008-06-06 11:29:13 -07:00
2008-06-06 11:29:13 -07:00
2008-05-07 18:35:03 +02:00
2008-01-30 13:31:46 +01:00
2008-04-30 08:29:47 -07:00
2008-06-23 13:07:00 -04:00
2008-05-01 13:08:16 -04:00
2008-05-01 13:08:50 -04:00
2008-05-01 13:08:16 -04:00
2007-05-21 09:18:19 -07:00
2008-05-01 13:08:16 -04:00
2007-05-08 11:15:01 -07:00
2008-05-06 13:13:37 -07:00
2008-02-06 10:41:07 -08:00
2008-04-29 08:06:00 -07:00
2008-06-06 11:29:08 -07:00
2008-01-30 13:31:46 +01:00
2008-02-14 21:13:33 -08:00
2008-04-30 08:29:51 -07:00
2008-05-01 13:08:50 -04:00
2008-02-14 21:13:33 -08:00
2008-04-29 08:06:00 -07:00
2008-05-01 13:08:50 -04:00