Re: Bugfix in dquot_transfer()

From: Carlos Carvalho (carlos@fisica.ufpr.br)
Date: Sun Sep 10 2000 - 18:09:44 EST


Jan Kara (jack@suse.cz) wrote on 4 September 2000 08:25:
> Following patch fixes bug in dquot_transfer() - while we were sleeping
>i_blocks might change and so number quota was miscounted. Patches are
>against 2.2.16 and 2.4.0-test6 (but should apply well on newer versions).

I seem to have problems with this patch. Our main/central/everything
server crashed 3 times apparently because of it (runs fine without
it). A simple dpkg-scanpackages or named -u nobody gets a segfault,
and the kernel oopses:

kernel: Unable to handle kernel NULL pointer dereference at virtual
        address 0000002c
kernel: current->tss.cr3 = 32bca000, %cr3 = 32bca000
kernel: *pde = 00000000
kernel: Oops: 0000
kernel: CPU: 0

I was keen to apply it because I'm having occasional problems with
quotas being above the real usage, mostly because of users running
jobs in other machines and accessing the disk via NFS.

This is with 2.2.17 patched with the below plus raid, ide, the latest
knfs, openwall and Andrea's VM-global-2.2.18pre2-6.bz2.

>--- linux/fs/dquot.c Tue Aug 29 11:01:00 2000
>+++ linux/fs/dquot.c Sat Sep 2 23:01:04 2000
>@@ -1260,14 +1260,6 @@
> if (!inode)
> return -ENOENT;
> /*
>- * Find out if this filesystem uses i_blocks.
>- */
>- if (inode->i_blksize == 0)
>- blocks = isize_to_blocks(inode->i_size, BLOCK_SIZE);
>- else
>- blocks = (inode->i_blocks / 2);
>-
>- /*
> * Build the transfer_from and transfer_to lists and check quotas to see
> * if operation is permitted.
> */
>@@ -1326,13 +1318,25 @@
> * dqget() could block and so the first structure might got
> * invalidated or locked...
> */
>- if (!transfer_to[cnt]->dq_mnt || !transfer_from[cnt]->dq_mnt ||
>- check_idq(transfer_to[cnt], cnt, 1, initiator, tty) == NO_QUOTA ||
>- check_bdq(transfer_to[cnt], cnt, blocks, initiator, tty, 0) == NO_QUOTA) {
>+ if (!transfer_to[cnt]->dq_mnt || !transfer_from[cnt]->dq_mnt) {
> cnt++;
> goto put_all;
> }
> }
>+
>+ /*
>+ * Find out if this filesystem uses i_blocks.
>+ */
>+ if (inode->i_blksize == 0)
>+ blocks = isize_to_blocks(inode->i_size, BLOCK_SIZE);
>+ else
>+ blocks = (inode->i_blocks / 2);
>+ for (cnt = 0; cnt < MAXQUOTAS; cnt++)
>+ if (check_idq(transfer_to[cnt], cnt, 1, initiator, tty) == NO_QUOTA ||
>+ check_bdq(transfer_to[cnt], cnt, blocks, initiator, tty, 0) == NO_QUOTA) {
>+ cnt = MAXQUOTAS;
>+ goto put_all;
>+ }
>
> if ((error = notify_change(dentry, iattr)))
> goto put_all;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:13 EST