From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 6 20:40:28 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF05716A4CE for ; Fri, 6 Aug 2004 20:40:28 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9757143D54 for ; Fri, 6 Aug 2004 20:40:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i76KeSh1052682 for ; Fri, 6 Aug 2004 20:40:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i76KeSjR052674; Fri, 6 Aug 2004 20:40:28 GMT (envelope-from gnats) Resent-Date: Fri, 6 Aug 2004 20:40:28 GMT Resent-Message-Id: <200408062040.i76KeSjR052674@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Amit Khivesara Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3016E16A4CE for ; Fri, 6 Aug 2004 20:32:41 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 259B643D46 for ; Fri, 6 Aug 2004 20:32:41 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i76KWeKh051150 for ; Fri, 6 Aug 2004 20:32:40 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i76KWelQ051149; Fri, 6 Aug 2004 20:32:40 GMT (envelope-from nobody) Message-Id: <200408062032.i76KWelQ051149@www.freebsd.org> Date: Fri, 6 Aug 2004 20:32:40 GMT From: Amit Khivesara To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: misc/70096: Full msdos file system causes corruption X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2004 20:40:29 -0000 >Number: 70096 >Category: misc >Synopsis: Full msdos file system causes corruption >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 06 20:40:28 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Amit Khivesara >Release: 4.9 >Organization: Utstarcom >Environment: root@psyche.nj.us.utstar.com:/home/khivi/p4/mobo-R4.0/os/freebsd/kernel/DISKLESS i386 >Description: When the file system gets full, then it stores a incorrect value of nxtfree into the disk fsinfo. This will cause the assert in : /* * Check and validate (or perhaps invalidate?) the fsinfo structure? */ if (pmp->pm_fsinfo && pmp->pm_nxtfree > pmp->pm_maxcluster) { printf( "Next free cluster in FSInfo (%lu) exceeds maxcluster (%lu)\n", pmp->pm_nxtfree, pmp->pm_maxcluster); error = EINVAL; goto error_exit; } to be fired. --- >How-To-Repeat: Fill up msdos file system. Sync and reboot. >Fix: --- msdosfs_fat.c.orig Wed Jun 16 11:16:37 2004 +++ msdosfs_fat.c Wed Jun 16 11:15:41 2004 @@ -434,8 +434,9 @@ for (cn = 0; cn < pmp->pm_maxcluster; cn += N_INUSEBITS) if (pmp->pm_inusemap[cn / N_INUSEBITS] != (u_int)-1) break; - pmp->pm_nxtfree = cn - + ffs(pmp->pm_inusemap[cn / N_INUSEBITS]^(u_int)-1) - 1; + pmp->pm_nxtfree = (cn < pmp->pm_maxcluster)? + (cn + ffs(pmp->pm_inusemap[cn / N_INUSEBITS]^(u_int)-1) - 1) + :0; } if (bread(pmp->pm_devvp, pmp->pm_fsinfo, fsi_size(pmp), NOCRED, &bpn) != 0) { >Release-Note: >Audit-Trail: >Unformatted: