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 another problem with quota cursor iteration....



details:   https://anonhg.NetBSD.org/src/rev/82ac32977140
branches:  trunk
changeset: 773687:82ac32977140
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Feb 13 06:23:41 2012 +0000

description:
Fix another problem with quota cursor iteration. ok riz

diffstat:

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

diffs (63 lines):

diff -r 4025f5d68147 -r 82ac32977140 sys/ufs/ufs/ufs_quota2.c
--- a/sys/ufs/ufs/ufs_quota2.c  Mon Feb 13 05:09:01 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota2.c  Mon Feb 13 06:23:41 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.33 2012/02/05 14:19:04 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.34 2012/02/13 06:23:41 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.33 2012/02/05 14:19:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.34 2012/02/13 06:23:41 dholland Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -957,6 +957,7 @@
        unsigned skip;          /* number of ids to skip over */
        unsigned new_skip;      /* number of ids to skip over next time */
        unsigned skipped;       /* number skipped so far */
+       int stopped;            /* true if we stopped quota_walk_list early */
 };
 
 /*
@@ -1109,6 +1110,7 @@
        gi->new_skip++;
        if (gi->state->numids >= gi->state->maxids) {
                /* got enough ids, stop now */
+               gi->stopped = 1;
                return Q2WL_ABORT;
        }
        return 0;
@@ -1175,11 +1177,16 @@
                gi.skip = cursor->q2c_uidpos;
                gi.new_skip = gi.skip;
                gi.skipped = 0;
+               gi.stopped = 0;
                offset = q2h->q2h_entries[cursor->q2c_hashpos];
 
                error = quota2_walk_list(ump, hbp, idtype, &offset, 0, &gi,
                    q2cursor_getids_callback);
-               if (error == Q2WL_ABORT) {
+               KASSERT(error != Q2WL_ABORT);
+               if (error) {
+                       break;
+               }
+               if (gi.stopped) {
                        /* callback stopped before reading whole chain */
                        cursor->q2c_uidpos = gi.new_skip;
                        /* if we didn't get both halves, back up */
@@ -1187,10 +1194,6 @@
                                KASSERT(cursor->q2c_uidpos > 0);
                                cursor->q2c_uidpos--;
                        }
-                       /* not an error */
-                       error = 0;
-               } else if (error) {
-                       break;
                } else {
                        /* read whole chain */
                        /* if we got both halves of the last id, advance */



Home | Main Index | Thread Index | Old Index