From 84ad0a66d0161562bb8fbce70be7e36f7a74520e Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Thu, 23 Dec 2010 00:38:57 +0000 Subject: [PATCH] This patch fixes a soft update panic while running perl 5.12 tests which produced: panic: indir_trunc: Index out of range -148 parent -2061 lbn -305164 Reported by: Dimitry Andric Fixed by: Jeff Roberson --- sys/ufs/ffs/ffs_softdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8ed68c329524..3278d6c7b8e3 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -6153,7 +6153,8 @@ indir_trunc(freework, dbn, lbn) if (jnewblk->jn_lbn > 0) i = (jnewblk->jn_lbn - -lbn) / lbnadd; else - i = (jnewblk->jn_lbn - (lbn + 1)) / lbnadd; + i = (-(jnewblk->jn_lbn + level - 1) - -(lbn + level)) / + lbnadd; KASSERT(i >= 0 && i < NINDIR(fs), ("indir_trunc: Index out of range %d parent %jd lbn %jd", i, lbn, jnewblk->jn_lbn));