diff options
author | Louis Rilling <Louis.Rilling@kerlabs.com> | 2008-06-16 19:01:02 +0200 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-07-14 22:57:16 +0200 |
commit | 6d8344baee99402de58b5fa5dfea197242955c15 (patch) | |
tree | 6be890feb8063bdaac6efaff1044980cb76ee961 /drivers/net/netconsole.c | |
parent | configfs: Fix deadlock with racing rmdir() and rename() (diff) | |
download | linux-6d8344baee99402de58b5fa5dfea197242955c15.tar.xz linux-6d8344baee99402de58b5fa5dfea197242955c15.zip |
configfs: Fix failing mkdir() making racing rmdir() fail
When fixing the rename() vs rmdir() deadlock, we stopped locking default groups'
inodes in configfs_detach_prep(), letting racing mkdir() in default groups
proceed concurrently. This enables races like below happen, which leads to a
failing mkdir() making rmdir() fail, despite the group to remove having no
user-created directory under it in the end.
process A: process B:
/* PWD=A/B */
mkdir("C")
make_item("C")
attach_group("C")
rmdir("A")
detach_prep("A")
detach_prep("B")
error because of "C"
return -ENOTEMPTY
attach_group("C/D")
error (eg -ENOMEM)
return -ENOMEM
This patch prevents such scenarii by making rmdir() wait as long as
detach_prep() fails because a racing mkdir() is in the middle of attach_group().
To achieve this, mkdir() sets a flag CONFIGFS_USET_IN_MKDIR in parent's
configfs_dirent before calling attach_group(), and clears the flag once
attach_group() is done. detach_prep() fails with -EAGAIN whenever the flag is
hit and returns the guilty inode's mutex so that rmdir() can wait on it.
Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'drivers/net/netconsole.c')
0 files changed, 0 insertions, 0 deletions