diff options
author | Jeff Mahoney <jeffm@suse.com> | 2005-07-27 14:43:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:25:50 -0400 |
commit | b3bb8afd965159f155d4f629cbea158cbcc69275 (patch) | |
tree | fffcb983d26aa1d435ba8e2b788a7aaf0b6efce0 /fs | |
parent | c9b3ad673460fc997a652cd58aa3a345d40e5218 (diff) |
[PATCH] reiserfs: fix deadlock in inode creation failure path w/ default ACL
reiserfs_new_inode() can call iput() with the xattr lock held. This will
cause a deadlock to occur when reiserfs_delete_xattrs() is called to clean
up.
The following patch releases the lock and reacquires it after the iput.
This is safe because interaction with xattrs is complete, and the relock is
just to balance out the release in the caller.
The locking needs some reworking to be more sane, but that's more intrusive
and I was just looking to fix this bug.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/reiserfs/inode.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 1aaf2c7d44e6..d9f614a57731 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1980,7 +1980,17 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | |||
1980 | out_inserted_sd: | 1980 | out_inserted_sd: |
1981 | inode->i_nlink = 0; | 1981 | inode->i_nlink = 0; |
1982 | th->t_trans_id = 0; /* so the caller can't use this handle later */ | 1982 | th->t_trans_id = 0; /* so the caller can't use this handle later */ |
1983 | iput(inode); | 1983 | |
1984 | /* If we were inheriting an ACL, we need to release the lock so that | ||
1985 | * iput doesn't deadlock in reiserfs_delete_xattrs. The locking | ||
1986 | * code really needs to be reworked, but this will take care of it | ||
1987 | * for now. -jeffm */ | ||
1988 | if (REISERFS_I(dir)->i_acl_default) { | ||
1989 | reiserfs_write_unlock_xattrs(dir->i_sb); | ||
1990 | iput(inode); | ||
1991 | reiserfs_write_lock_xattrs(dir->i_sb); | ||
1992 | } else | ||
1993 | iput(inode); | ||
1984 | return err; | 1994 | return err; |
1985 | } | 1995 | } |
1986 | 1996 | ||