Re: 5000 emails later, compressed summary ;)

Andrea Arcangeli (arcangeli@mbox.queen.it)
Wed, 3 Jun 1998 21:26:16 +0200 (CEST)


On 3 Jun 1998, Andi Kleen wrote:

>2.0 has some known races and deadlocks in the quota code. I've send the
>reporter some fixes, but I'm still waiting for feedback. It would be nice if
>those could be incorporated into 2.0.34.

Could show me your quota antideadlock patch? I worked for some hours last
night to _try_ to fix a possible quota deadlock reported by a guy that
was killing httpsd.

I' ll try to describe what I have "discovered" ("discovered" is from my
point of view of course ;-).

When the process is killed the kernel iput() inodes and so recall
ext2_free_inode() that lock_super() and then with the superblock locked
recall clear_inode(). clear_inode() will drop the inode quota recalling
dquot_drop() that uses dqput() to do that. dqput() then will
wait_on_dquot() so if it will go ahead we will sure that the dquote lock
is not set. Then we (*) wake_up() all other process that was sleeping on
the dquote lock and we write_dquot(). write_dquot() at first
lock_dquote(). Is the lock_dquote() that put the process to sleep with
the superblock locked that causes the deadlock (but I could be wrong since
I don' t know well the fs code).

Since before (*) we are sure that a lock_dquote() will not cause a process
sleep I removed the wakeup() on the dquote lock, that will be done then
automatically at exit of write_dquote() (since it will recall
unlock_dquote()). I also removed wait_on_dquote() after the write_dquote()
since it seems not needed (but could be wrong on that too).

You can find my not commented (was too late ;-) patch just now in
linux-kernel (I posted the patch here last night).

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu