[PATCH] Fix possible oops on quotaoff

From: Jan Kara
Date: Thu Mar 31 2005 - 07:34:01 EST


Hi!

Attached one-liner should fix possible Oops on quotaoff - the code
does not expect quotafiles to have any dquots initialized but they
actually could have some in the following scenario:
turn on one quota type
write to the file with the other quota type (quota gets initialize)
turn on the other quota type

Please apply the fix (it should apply well to any recent kernel)

Honza

--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
Remove dquot structures from quota file on quotaon - quota code does not expect them
to be there.

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

diff -rupX /home/jack/.kerndiffexclude linux-2.6.11/fs/dquot.c linux-2.6.11-dropfix/fs/dquot.c
--- linux-2.6.11/fs/dquot.c 2005-03-30 13:37:05.000000000 +0200
+++ linux-2.6.11-dropfix/fs/dquot.c 2005-03-31 14:03:45.000000000 +0200
@@ -1444,6 +1444,7 @@ static int vfs_quota_on_inode(struct ino
oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | S_NOQUOTA);
inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
up_write(&dqopt->dqptr_sem);
+ sb->dq_op->drop(inode);

error = -EIO;
dqopt->files[type] = igrab(inode);