Module Name:    src
Committed By:   bouyer
Date:           Fri Feb 11 16:55:35 UTC 2011

Modified Files:
        src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/ufs/ufs/ufs_quota2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.13 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.14
--- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.13	Thu Feb 10 16:16:05 2011
+++ src/sys/ufs/ufs/ufs_quota2.c	Fri Feb 11 16:55:35 2011
@@ -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);
 		}

Reply via email to