Skip to content

Commit

Permalink
[PATCH] reiserfs: fix deadlock in inode creation failure path w/ defa…
Browse files Browse the repository at this point in the history
…ult 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>
  • Loading branch information
Jeff Mahoney authored and Linus Torvalds committed Jul 27, 2005
1 parent c9b3ad6 commit b3bb8af
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,17 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
out_inserted_sd:
inode->i_nlink = 0;
th->t_trans_id = 0; /* so the caller can't use this handle later */
iput(inode);

/* If we were inheriting an ACL, we need to release the lock so that
* iput doesn't deadlock in reiserfs_delete_xattrs. The locking
* code really needs to be reworked, but this will take care of it
* for now. -jeffm */
if (REISERFS_I(dir)->i_acl_default) {
reiserfs_write_unlock_xattrs(dir->i_sb);
iput(inode);
reiserfs_write_lock_xattrs(dir->i_sb);
} else
iput(inode);
return err;
}

Expand Down

0 comments on commit b3bb8af

Please sign in to comment.