Re: BUG: reiserfs+acl+quota deadlock

From: Jan Kara
Date: Thu Aug 18 2005 - 09:37:11 EST


Hello,

> Jan Kara wrote:
> >>Tried the attached patch but it changed nothing, I trying to create
> >>a new file as a user whose quota grace time has ran out will still
> >>cause everything accessing the users homedir (the one with the quota)
> >>to hang in D state.
> >>
> >>Also note that the bug I reported only exists when acl is also
> >>enabled (does not have to be used). And although my kernel is not
> >>built with debug (or reiserfs debug) support, I don't get any
> >>oopses or reiserfs errors.. it just hangs.
> >
>
> It looks like the problem is that reiserfs_new_inode can be called either
> having xattrs locked or not.
> It does unlocking/locking xattrs on error handling path, but has no idea
> about whether
> xattrs are locked of not.
> The attached patch seems to fix the problem.
> I am not sure whether it is correct way to fix this problem, though.
I've already fixed this problem and Andrew accepted the patch into
-mm. I took a bit different approach but yours might be better in a long
run (mine is just a one liner). The patch is attached if you're
interested.

Honza
--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
When i_acl_default is set to some error we do not hold the lock (hence we are
not allowed to drop it and reacquire later).

Signed-off-by: Jan Kara <jack@xxxxxxx>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.13-rc6-1-reiser_create_fix/fs/reiserfs/inode.c linux-2.6.13-rc6-2-reiser_xattr_fix/fs/reiserfs/inode.c
--- linux-2.6.13-rc6-1-reiser_create_fix/fs/reiserfs/inode.c 2005-08-14 17:10:21.000000000 +0200
+++ linux-2.6.13-rc6-2-reiser_xattr_fix/fs/reiserfs/inode.c 2005-08-14 17:11:35.000000000 +0200
@@ -1985,7 +1985,7 @@ int reiserfs_new_inode(struct reiserfs_t
* 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) {
+ if (REISERFS_I(dir)->i_acl_default && !IS_ERR(REISERFS_I(dir)->i_acl_default)) {
reiserfs_write_unlock_xattrs(dir->i_sb);
iput(inode);
reiserfs_write_lock_xattrs(dir->i_sb);