2003-11-24 09:39:04

by Jan Kara

[permalink] [raw]
Subject: [PATCH] Fix possible oops in sync_dquots

Hi Andrew,

I'm sending you a fix of possible Oops in vfs_quota_sync(). Actually
nobody has run into that I found it when I was looking through the
code... The patch is against -test9 but should apply against -test10
too. Please apply.

Honza

PS: Linus, if you find it interesting for your patch queue then apply
too :)...

diff -ruX ../kerndiffexclude linux-2.6.0-test9-um/fs/dquot.c linux-2.6.0-test9-syncfix/fs/dquot.c
--- linux-2.6.0-test9-um/fs/dquot.c Thu Nov 6 19:10:37 2003
+++ linux-2.6.0-test9-syncfix/fs/dquot.c Mon Nov 24 10:31:41 2003
@@ -192,6 +192,8 @@

struct dqstats dqstats;

+static void dqput(struct dquot *dquot);
+
static inline int const hashfn(struct super_block *sb, unsigned int id, int type)
{
return((((unsigned long)sb>>L1_CACHE_SHIFT) ^ id) * (MAXQUOTAS - type)) % NR_DQHASH;
@@ -339,8 +341,11 @@
continue;
if (!dquot_dirty(dquot))
continue;
+ atomic_inc(&dquot->dq_count);
+ dqstats.lookups++;
spin_unlock(&dq_list_lock);
sb->dq_op->sync_dquot(dquot);
+ dqput(dquot);
goto restart;
}
spin_unlock(&dq_list_lock);