lkml.org 
[lkml]   [2005]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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>

diff -ruNpX dontdiff linux-2.6.13-rc3/fs/reiserfs/inode.c linux-2.6.13-rc3.errors/fs/reiserfs/inode.c
--- linux-2.6.13-rc3.1/fs/reiserfs/inode.c 2005-07-14 19:43:14.000000000 -0400
+++ linux-2.6.13-rc3.2/fs/reiserfs/inode.c 2005-07-18 15:21:32.000000000 -0400
@@ -1980,7 +1978,17 @@ int reiserfs_new_inode(struct reiserfs_t
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;
}

--
Jeff Mahoney
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-18 19:33    [W:0.027 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site