summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2013-04-04 17:29:37 +0000
committerBob Beck <beck@cvs.openbsd.org>2013-04-04 17:29:37 +0000
commitfe585b647bf5a928c2f133bae11b94d19bef9ce2 (patch)
tree9b9fad85b7fa443aab90c3c18f87cb9d4a36db4e /sys/ufs/ffs
parente2238470752af3c8a0ee30bbc9b8c34d8d962782 (diff)
Fix bug where clear_remove() and clear_inodedeps() would not iterate
over the entire pagedep and inodedep hash tables due to an off-by-one mistake in loops. Spotted by and diff from Pedro Martelletto. Sent upstream to Kirk and also fixed in FreeBSD. ok otto@ millert@
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_softdep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 01150f826ea..2d3ffb4e9a9 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.116 2013/02/17 17:39:29 miod Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.117 2013/04/04 17:29:36 beck Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -5320,9 +5320,9 @@ clear_remove(struct proc *p)
ino_t ino;
ACQUIRE_LOCK(&lk);
- for (cnt = 0; cnt < pagedep_hash; cnt++) {
+ for (cnt = 0; cnt <= pagedep_hash; cnt++) {
pagedephd = &pagedep_hashtbl[next++];
- if (next >= pagedep_hash)
+ if (next > pagedep_hash)
next = 0;
LIST_FOREACH(pagedep, pagedephd, pd_hash) {
if (LIST_FIRST(&pagedep->pd_dirremhd) == NULL)
@@ -5376,9 +5376,9 @@ clear_inodedeps(struct proc *p)
* We will then gather up all the inodes in its block
* that have dependencies and flush them out.
*/
- for (cnt = 0; cnt < inodedep_hash; cnt++) {
+ for (cnt = 0; cnt <= inodedep_hash; cnt++) {
inodedephd = &inodedep_hashtbl[next++];
- if (next >= inodedep_hash)
+ if (next > inodedep_hash)
next = 0;
if ((inodedep = LIST_FIRST(inodedephd)) != NULL)
break;