Re: Patch for 2.1.110 dquot oops

Bill Hawes (whawes@star.net)
Fri, 24 Jul 1998 18:07:31 -0400


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

Carsten Gross wrote:

> Thanks a lot for the patch. There was a small problem (see the "one liner"
> below), now the kernel compiles and boots up without problems.
>
> I'm using quotas since June, this could be the reason that I never noticed
> this problem before.

Hi Carsten,

Glad to hear things are working again with quotas. I fixed the spelling
of "super_block", and also noticed that the routine to reset quotas has
the same NULL dentry problem. (I should have looked more closely the
first time.)

The attached updated patch should avoid problems both coming and going
...

I'm still not sure why this just started happening in 2.1.110, but one
idea is that maybe someone has done a get_empty_filp(), bailed out on
error, and forgotten to do a put_filp(). Then there would always be an
empty filp on the list, and the quota code would consistently oops. So
maybe there's a filp leak ...

Regards,
Bill
--------------30EAD4F2477B6DE20224E37B
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 17:57:44 1998
@@ -531,15 +531,23 @@

static void add_dquot_ref(kdev_t dev, short type)
{
+ struct super_block *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;
}
}
@@ -547,16 +555,23 @@

static void reset_dquot_ptrs(kdev_t dev, short type)
{
+ struct super_block *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 (IS_QUOTAINIT(inode)) {
- if (inode->i_sb && inode->i_sb->dq_op)
- inode->i_sb->dq_op->drop(inode);
+ sb->dq_op->drop(inode);
inode->i_dquot[type] = NODQUOT;
inode->i_flags &= ~S_QUOTA;
}

--------------30EAD4F2477B6DE20224E37B--

-
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