Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ufs Fix problems in cursor iteration that came to li...
details: https://anonhg.NetBSD.org/src/rev/80cd761beb67
branches: trunk
changeset: 773375:80cd761beb67
user: dholland <dholland%NetBSD.org@localhost>
date: Wed Feb 01 05:10:44 2012 +0000
description:
Fix problems in cursor iteration that came to light when iterating one
value at a time, instead of in bulk. Yeah, repquota should do bulk get,
but it doesn't yet.
diffstat:
sys/ufs/ufs/ufs_quota2.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (56 lines):
diff -r 330519f7a7da -r 80cd761beb67 sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c Wed Feb 01 05:07:08 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c Wed Feb 01 05:10:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.30 2012/01/29 07:21:00 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.31 2012/02/01 05:10:44 dholland Exp $ */
/*-
* Copyright (c) 2010 Manuel Bouyer
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.30 2012/01/29 07:21:00 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.31 2012/02/01 05:10:44 dholland Exp $");
#include <sys/buf.h>
#include <sys/param.h>
@@ -1158,7 +1158,10 @@
/* If we haven't done the defaults yet, that goes first. */
if (cursor->q2c_defaults_done == 0) {
q2cursor_addid(state, idtype, QUOTA_DEFAULTID);
- cursor->q2c_defaults_done = 1;
+ /* if we read both halves, mark it done */
+ if (state->numids < state->maxids || !state->skiplast) {
+ cursor->q2c_defaults_done = 1;
+ }
}
gi.state = state;
@@ -1181,14 +1184,22 @@
if (error == Q2WL_ABORT) {
/* callback stopped before reading whole chain */
cursor->q2c_uidpos = gi.new_skip;
+ /* if we didn't get both halves, back up */
+ if (state->numids == state->maxids && state->skiplast){
+ KASSERT(cursor->q2c_uidpos > 0);
+ cursor->q2c_uidpos--;
+ }
/* not an error */
error = 0;
} else if (error) {
break;
} else {
- /* read whole chain, advance to next */
- cursor->q2c_uidpos = 0;
- cursor->q2c_hashpos++;
+ /* read whole chain */
+ /* if we got both halves of the last id, advance */
+ if (state->numids < state->maxids || !state->skiplast){
+ cursor->q2c_uidpos = 0;
+ cursor->q2c_hashpos++;
+ }
}
}
Home |
Main Index |
Thread Index |
Old Index