From owner-freebsd-fs@FreeBSD.ORG Thu Aug 12 06:52:23 2004 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD31816A4CE for ; Thu, 12 Aug 2004 06:52:23 +0000 (GMT) Received: from mail.freebsd.org.cn (dns3.freebsd.org.cn [61.129.66.75]) by mx1.FreeBSD.org (Postfix) with SMTP id 83A5543D58 for ; Thu, 12 Aug 2004 06:52:21 +0000 (GMT) (envelope-from delphij@frontfree.net) Received: (qmail 1818 invoked by uid 0); 12 Aug 2004 06:49:44 -0000 Received: from unknown (HELO beastie.frontfree.net) (219.239.98.7) by mail.freebsd.org.cn with SMTP; 12 Aug 2004 06:49:44 -0000 Received: from localhost (localhost.frontfree.net [127.0.0.1]) by beastie.frontfree.net (Postfix) with ESMTP id DC7E5122A0; Thu, 12 Aug 2004 14:52:16 +0800 (CST) Received: from beastie.frontfree.net ([127.0.0.1]) by localhost (beastie.frontfree.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02821-01; Thu, 12 Aug 2004 14:52:13 +0800 (CST) Received: by beastie.frontfree.net (Postfix, from userid 1001) id 6B6C811D15; Thu, 12 Aug 2004 14:52:12 +0800 (CST) Date: Thu, 12 Aug 2004 14:52:12 +0800 From: Xin LI To: freebsd-fs@FreeBSD.org Message-ID: <20040812065212.GA245@frontfree.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-GPG-key-ID/Fingerprint: 0xCAEEB8C0 / 43B8 B703 B8DD 0231 B333 DC28 39FB 93A0 CAEE B8C0 X-GPG-Public-Key: http://www.delphij.net/delphij.asc X-Operating-System: FreeBSD beastie.frontfree.net 5.2-delphij FreeBSD 5.2-delphij #3: Fri Jul 30 20:01:43 CST 2004 delphij@beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386 X-URL: http://www.delphij.net X-By: delphij@beastie.frontfree.net X-Location: Beijing, China X-Virus-Scanned: by amavisd-new at frontfree.net cc: alfred@FreeBSD.org cc: rwatson@FreeBSD.org cc: mckusick@FreeBSD.org Subject: Question about the FFS snapshot code X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 06:52:23 -0000 --5/uDoXvLw7AC5HRs Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi folks, I have by chance got a panic right after another panic's reboot, which seems to be related to the patch attached. The problem seems to be not easy to reproduce and I don't have much knowledge about the snapshot code, so I would rather request for some comment on the proposaled change. The rationale: Revision 1.27 of ffs_snapshot.c has introduced an additional cleanup during taking a snapshot, as the commit log said: ``When taking a snapshot, we must check for active files that have been unlinked (e.g., with a zero link count). We have to expunge all trace of these files from the snapshot so that they are neither reclaimed prematurely by fsck nor saved unnecessarily by dump.'' And on HEAD, we found some related code, starting at line 447: /* * If there is a fragment, clear it here. */ blkno =3D 0; loc =3D howmany(xp->i_size, fs->fs_bsize) - 1; if (loc < NDADDR) { len =3D fragroundup(fs, blkoff(fs, xp->i_size)); -------->>>>> len could be 0? if (len < fs->fs_bsize) { ffs_blkfree(copy_fs, vp, DIP(xp, i_db[loc]), len, xp->i_number); blkno =3D DIP(xp, i_db[loc]); DIP_SET(xp, i_db[loc], 0); } } I have a suspect that len could got a zero after the line marked. Subsequent ``if'' statement would pass beacuse 0 is always less then fs->fs_bsize. This might get some unwanted result, in my opinion. Any comments is appreciated. Cheers, --=20 Xin LI http://www.delphij.net/ See complete headers for GPG key and other information. --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-ffs_snapshot.c" Index: ffs_snapshot.c =================================================================== RCS file: /home/fcvs/src/sys/ufs/ffs/ffs_snapshot.c,v retrieving revision 1.84 diff -u -r1.84 ffs_snapshot.c --- ffs_snapshot.c 28 Jul 2004 06:41:27 -0000 1.84 +++ ffs_snapshot.c 10 Aug 2004 17:30:04 -0000 @@ -451,7 +451,7 @@ loc = howmany(xp->i_size, fs->fs_bsize) - 1; if (loc < NDADDR) { len = fragroundup(fs, blkoff(fs, xp->i_size)); - if (len < fs->fs_bsize) { + if ((len != 0) && (len < fs->fs_bsize)) { ffs_blkfree(copy_fs, vp, DIP(xp, i_db[loc]), len, xp->i_number); blkno = DIP(xp, i_db[loc]); --k+w/mQv8wyuph6w0-- --5/uDoXvLw7AC5HRs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iD8DBQFBGxOcOfuToMruuMARAvFvAJ9mwq62WOrwaD4e9G4YAkqFe8hizwCfS0TH mxKpjmR0MIr2iY7pAqJopqg= =BtDw -----END PGP SIGNATURE----- --5/uDoXvLw7AC5HRs--