Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-quota2]: src/sys/ufs/ufs walk_list: make sure we don't try to rea...



details:   https://anonhg.NetBSD.org/src/rev/e63f71a267fe
branches:  bouyer-quota2
changeset: 761165:e63f71a267fe
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Feb 11 16:55:35 2011 +0000

description:
walk_list: make sure we don't try to read the same quota disk block again
without releasing it first

diffstat:

 sys/ufs/ufs/ufs_quota2.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 7223c08e0c3e -r e63f71a267fe sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c  Fri Feb 11 16:54:35 2011 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c  Fri Feb 11 16:55:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.1.2.14 2011/02/11 16:55:35 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.1.2.14 2011/02/11 16:55:35 bouyer Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -155,7 +155,7 @@
        struct buf *bp, *obp = hbp;
        int ret = 0, ret2 = 0;
        struct quota2_entry *q2e;
-       daddr_t lblkno, blkoff;
+       daddr_t lblkno, blkoff, olblkno = 0;
 
        KASSERT(mutex_owner(&dqlock));
 
@@ -165,6 +165,9 @@
                if (lblkno == 0) {
                        /* in the header block */
                        bp = hbp;
+               } else if (lblkno == olblkno) {
+                       /* still in the same buf */
+                       bp = obp;
                } else {
                        ret = bread(ump->um_quotas[type], lblkno, 
                            ump->umq2_bsize,
@@ -192,6 +195,7 @@
                                        brelse(obp, 0);
                        }
                        obp = bp;
+                       olblkno = lblkno;
                        offp = &(q2e->q2e_next);
                        off = ufs_rw64(*offp, needswap);
                }



Home | Main Index | Thread Index | Old Index