Patch for 2.1.110 dquot oops

Bill Hawes (whawes@star.net)
Fri, 24 Jul 1998 15:49:06 -0400


This is a multi-part message in MIME format.
--------------FDAE89FB1FDF01F4BEE0C41E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Carsten Gross wrote:

> Linux Kernel 2.1.110 oopses while executing "quotaon". It is compiled for
> SMP and using diskquotas. No problem with quotas in kernel version 2.1.109.

Hi Carsten,

I see the probable cause of your quotaon oops, but would guess that it
should have been happening at least sporadically for a while.

The problem is that when a new filp is obtained from get_empty_filp(),
it is immediately placed on the inuse list, but doesn't initially have a
dentry. Any code that checks the inuse filp list is supposed to screen
out these cases, but the dquot code doesn't. So if somebody has a new
uninitialized filp when you happen to do your quotaon, you get an oops.

I've attached a patch that should fix the problem, and speed up the
search as well. It tests whether the superblock has a quota op outside
the loop, and uses the dentry d_sb field to check against the sb value
before getting the inode.

The patch is untested, uncompiled, and may not pass the Torvalds-test,
but will work fine if we're both lucky today.

Regards,
Bill
--------------FDAE89FB1FDF01F4BEE0C41E
Content-Type: text/plain; charset=us-ascii; name="dquot_110-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dquot_110-patch"

--- linux-2.1.110/fs/dquot.c.old Fri Jul 3 10:32:31 1998
+++ linux-2.1.110/fs/dquot.c Fri Jul 24 15:34:24 1998
@@ -531,15 +531,23 @@

static void add_dquot_ref(kdev_t dev, short type)
{
+ struct superblock *sb = get_super(dev);
struct file *filp;
struct inode *inode;

+ if (!sb || !sb->dq_op)
+ return; /* nothing to do */
+
for (filp = inuse_filps; filp; filp = filp->f_next) {
+ if (!filp->f_dentry)
+ continue;
+ if (filp->f_dentry->d_sb != sb)
+ continue;
inode = filp->f_dentry->d_inode;
- if (!inode || inode->i_dev != dev)
+ if (!inode)
continue;
- if (filp->f_mode & FMODE_WRITE && inode->i_sb && inode->i_sb->dq_op) {
- inode->i_sb->dq_op->initialize(inode, type);
+ if (filp->f_mode & FMODE_WRITE) {
+ sb->dq_op->initialize(inode, type);
inode->i_flags |= S_QUOTA;
}
}

--------------FDAE89FB1FDF01F4BEE0C41E--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html