Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Apr 2013 00:12:32 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r249597 - stable/9/sys/ufs/ffs
Message-ID:  <201304180012.r3I0CW20015380@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Thu Apr 18 00:12:32 2013
New Revision: 249597
URL: http://svnweb.freebsd.org/changeset/base/249597

Log:
  MFC of 249064:
  
  The code in clear_remove() and clear_inodedeps() skips one entry
  in the pagedep and inodedep hash tables. An entry in the table is
  skipped because 'pagedep_hash' and 'inodedep_hash' hold the size
  of the hash tables - 1.
  
  The chance that this would have any operational failure is extremely
  unlikely. These funtions only need to find a single entry and are
  only called when there are too many entries. The chance that they
  would fail because all the entries are on the single skipped hash
  chain are remote.
  
  Submitted by: Pedro Martelletto
  Reviewed by:  kib

Modified:
  stable/9/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_softdep.c	Wed Apr 17 22:42:43 2013	(r249596)
+++ stable/9/sys/ufs/ffs/ffs_softdep.c	Thu Apr 18 00:12:32 2013	(r249597)
@@ -13026,9 +13026,9 @@ clear_remove(td)
 
 	mtx_assert(&lk, MA_OWNED);
 
-	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_EMPTY(&pagedep->pd_dirremhd))
@@ -13090,9 +13090,9 @@ clear_inodedeps(td)
 	 * 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304180012.r3I0CW20015380>