From owner-freebsd-current@FreeBSD.ORG Sun Oct 16 22:45:01 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C59B516A41F; Sun, 16 Oct 2005 22:45:01 +0000 (GMT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A54143D4C; Sun, 16 Oct 2005 22:45:01 +0000 (GMT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.13.4/8.13.4) with ESMTP id j9GMimO3037397; Sun, 16 Oct 2005 15:44:48 -0700 (PDT) Received: (from dillon@localhost) by apollo.backplane.com (8.13.4/8.13.4/Submit) id j9GMimWx037396; Sun, 16 Oct 2005 15:44:48 -0700 (PDT) Date: Sun, 16 Oct 2005 15:44:48 -0700 (PDT) From: Matthew Dillon Message-Id: <200510162244.j9GMimWx037396@apollo.backplane.com> To: obrien@freebsd.org, freebsd-current@freebsd.org References: <20050926152952.GA1670@dragon.NUXI.org> <20050926160808.GB1649@dragon.NUXI.org> <200510141940.j9EJeYsn024832@apollo.backplane.com> <200510162211.j9GMBZED037255@apollo.backplane.com> Cc: Subject: Re: [PANIC] ufs_dirbad: bad dir X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2005 22:45:01 -0000 Ach. sigh. Another false alarm. Sorry. The code is fine. It's because the 'end' block is calculated inclusively, e.g. end_lbn = start_lbn + len - 1. I'm still investigating it. There is a bug if the range reallocblks is called with spans more then two blockmaps, but I don't think that case can occur in real life due to limitations in the range passed by the caller. Probably worth a KASSERT, though. -Matt Matthew Dillon : /* : * If the block range spans two block maps, get the second map. : */ : if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { : ssize = len; : } else { :#ifdef DIAGNOSTIC : if (start_ap[start_lvl-1].in_lbn == idp->in_lbn) : panic("ffs_reallocblk: start == end"); :#endif : ssize = len - (idp->in_off + 1); : ^^^^^^^^^^^^^^^^^^^^^ : This doesn't look right. It kinda seems to me : that it should be (len - idp->in_off). : : : if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, &ebp)) : goto fail; : ebap = (ufs_daddr_t *)ebp->b_data; : } : : I went through about 3 or 4 false alarms earlier today, and this could : be another one. But if it is wrong it would fit the symptoms.... : the first indirect block in the inode getting blown to bits. : : -Matt : Matthew Dillon