From nobody@FreeBSD.org Tue Aug 5 21:36:26 2008 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675FD106567B for ; Tue, 5 Aug 2008 21:36:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 55ED78FC0A for ; Tue, 5 Aug 2008 21:36:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m75LaPbE029325 for ; Tue, 5 Aug 2008 21:36:25 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m75LaP1H029324; Tue, 5 Aug 2008 21:36:25 GMT (envelope-from nobody) Message-Id: <200808052136.m75LaP1H029324@www.freebsd.org> Date: Tue, 5 Aug 2008 21:36:25 GMT From: Carel Braam To: freebsd-gnats-submit@FreeBSD.org Subject: Kernel panics while mounting an UFS filesystem with snapshot enabled X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 126287 >Category: kern >Synopsis: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-fs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Aug 05 21:40:03 UTC 2008 >Closed-Date: >Last-Modified: Thu Aug 7 23:30:01 UTC 2008 >Originator: Carel Braam >Release: 7.0-STABLE >Organization: Eindhoven University >Environment: FreeBSD cbraam.icts.tue.nl 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Aug 5 20:34:23 CEST 2008 cbraam@cbraam.icts.tue.nl:/var/usr/obj/usr/src/sys/CBraam i386 >Description: After compiling a new version of Free BSD 3 weeks ago, the system crashed during the reboot. Further investigation pointed out that mounting UFS filesystems with snapshots enabled caused the crash. Mounting the filesystems without snapshot enabled circumvented the problem. But snapshots do not work anymore. >How-To-Repeat: Mount ufs filesystems with snapshot enabled. >Fix: >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-fs Responsible-Changed-By: linimon Responsible-Changed-When: Wed Aug 6 00:14:52 UTC 2008 Responsible-Changed-Why: Over to maintainer(s). http://www.freebsd.org/cgi/query-pr.cgi?pr=126287 From: "Remko Lodder" To: "Carel Braam" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: kern/126287: Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 08:54:14 +0200 (CEST) On Tue, August 5, 2008 11:36 pm, Carel Braam wrote: Hello Carel, This information is a bit narrow. If the kernel panics, you should be able to get a kernelcoredump. Please follow the procedure at http://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug.html. Thanks, Remko -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From: "Mateusz Guzik" To: bug-followup@freebsd.org Cc: Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 11:24:16 +0200 ------=_Part_20104_30199813.1218014656704 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, function vfs_deleteopt() was called with NULL pointer (opts) used in TAILQ_FOREACH_SAFE macro -- I believe that simple `if (opts == NULL) return; ' in that function is ok to fix this. (Take a look at attachment.) At least the kernel does not panic. ;) Thanks, -- Mateusz Guzik ------=_Part_20104_30199813.1218014656704 Content-Type: application/octet-stream; name=vfs_mount.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_fjjqf5in0 Content-Disposition: attachment; filename=vfs_mount.diff LS0tIHN5cy9rZXJuL3Zmc19tb3VudC5jLm9yaWcJMjAwOC0wOC0wNiAxMToxNDoxNi4wMDAwMDAw MDAgKzAyMDAKKysrIHN5cy9rZXJuL3Zmc19tb3VudC5jCTIwMDgtMDgtMDYgMTE6MTQ6MzIuMDAw MDAwMDAwICswMjAwCkBAIC0xOTYsMTAgKzE5NiwxMyBAQAogdm9pZAogdmZzX2RlbGV0ZW9wdChz dHJ1Y3QgdmZzb3B0bGlzdCAqb3B0cywgY29uc3QgY2hhciAqbmFtZSkKIHsKIAlzdHJ1Y3QgdmZz b3B0ICpvcHQsICp0ZW1wOwogCisJaWYgKG9wdHMgPT0gTlVMTCkKKwkJcmV0dXJuOworCiAJVEFJ TFFfRk9SRUFDSF9TQUZFKG9wdCwgb3B0cywgbGluaywgdGVtcCkgIHsKIAkJaWYgKHN0cmNtcChv cHQtPm5hbWUsIG5hbWUpID09IDApCiAJCQl2ZnNfZnJlZW9wdChvcHRzLCBvcHQpOwogCX0KIH0K ------=_Part_20104_30199813.1218014656704-- From: "Mateusz Guzik" To: bug-followup@freebsd.org Cc: Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 12:15:00 +0200 Something weird happened to my attachment, I'll paste it here: --- sys/kern/vfs_mount.c.orig 2008-08-06 11:14:16.000000000 +0200 +++ sys/kern/vfs_mount.c 2008-08-06 11:14:32.000000000 +0200 @@ -196,10 +196,13 @@ void vfs_deleteopt(struct vfsoptlist *opts, const char *name) { struct vfsopt *opt, *temp; + if (opts == NULL) + return; + TAILQ_FOREACH_SAFE(opt, opts, link, temp) { if (strcmp(opt->name, name) == 0) vfs_freeopt(opts, opt); } } Again, it should work fine ;) Thanks, -- Mateusz Guzik From: Kostik Belousov To: Mateusz Guzik Cc: freebsd-fs@freebsd.org, bug-followup@freebsd.org Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 16:34:41 +0300 --11IAkegDWp8TRrA/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 06, 2008 at 10:20:05AM +0000, Mateusz Guzik wrote: > The following reply was made to PR kern/126287; it has been noted by GNAT= S. >=20 > From: "Mateusz Guzik" > To: bug-followup@freebsd.org > Cc: =20 > Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an U= FS filesystem with snapshot enabled > Date: Wed, 6 Aug 2008 12:15:00 +0200 >=20 > Something weird happened to my attachment, I'll paste it here: > =20 > --- sys/kern/vfs_mount.c.orig 2008-08-06 11:14:16.000000000 +0200 > +++ sys/kern/vfs_mount.c 2008-08-06 11:14:32.000000000 +0200 > @@ -196,10 +196,13 @@ > void > vfs_deleteopt(struct vfsoptlist *opts, const char *name) > { > struct vfsopt *opt, *temp; > =20 > + if (opts =3D=3D NULL) > + return; > + > TAILQ_FOREACH_SAFE(opt, opts, link, temp) { > if (strcmp(opt->name, name) =3D=3D 0) > vfs_freeopt(opts, opt); > } > } > =20 > Again, it should work fine ;) > =20 > Thanks, > -- > Mateusz Guzik The PR lacks the backtrace (preferrable the ddb output or "bt full" from kgdb) for the panic. Please, show me the backtrace. --11IAkegDWp8TRrA/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkiZqHAACgkQC3+MBN1Mb4jCYQCg8Zuw0keIHdOXrkv9Q5yK8M6r tEkAn3GayEaX5S9xQqiqDRBTooAe8ggD =zxuG -----END PGP SIGNATURE----- --11IAkegDWp8TRrA/-- From: "Mateusz Guzik" To: "Kostik Belousov" Cc: freebsd-fs@freebsd.org, bug-followup@freebsd.org Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 15:52:24 +0200 2008/8/6 Kostik Belousov : > On Wed, Aug 06, 2008 at 10:20:05AM +0000, Mateusz Guzik wrote: >> The following reply was made to PR kern/126287; it has been noted by GNATS. >> >> From: "Mateusz Guzik" >> To: bug-followup@freebsd.org >> Cc: >> Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled >> Date: Wed, 6 Aug 2008 12:15:00 +0200 >> >> Something weird happened to my attachment, I'll paste it here: >> >> --- sys/kern/vfs_mount.c.orig 2008-08-06 11:14:16.000000000 +0200 >> +++ sys/kern/vfs_mount.c 2008-08-06 11:14:32.000000000 +0200 >> @@ -196,10 +196,13 @@ >> void >> vfs_deleteopt(struct vfsoptlist *opts, const char *name) >> { >> struct vfsopt *opt, *temp; >> >> + if (opts == NULL) >> + return; >> + >> TAILQ_FOREACH_SAFE(opt, opts, link, temp) { >> if (strcmp(opt->name, name) == 0) >> vfs_freeopt(opts, opt); >> } >> } >> >> Again, it should work fine ;) > > The PR lacks the backtrace (preferrable the ddb output or "bt full" from > kgdb) for the panic. Please, show me the backtrace. > Sorry, I don't have currently access to fbsd 7, so here is backtrace from CURRENT(crashed by mount -o snapshot /somefilesystem): [..] #11 0xc06e1e5b in calltrap () at /srv/build/CURRENT/src/sys/i386/i386/exception.s:165 #12 0xc05c86d4 in vfs_deleteopt (opts=0x0, name=0xc074ef52 "snapshot") at /srv/build/CURRENT/src/sys/kern/vfs_mount.c:195 #13 0xc068d689 in ffs_mount (mp=0xc29f52a0, td=0xc2875af0) at /srv/build/CURRENT/src/sys/ufs/ffs/ffs_vfsops.c:172 #14 0xc05cb1d8 in vfs_donmount (td=0xc2875af0, fsflags=0, fsoptions=0xc261db80) at /srv/build/CURRENT/src/sys/kern/vfs_mount.c:1010 #15 0xc05cc3bb in nmount (td=0xc2875af0, uap=0xcd3a7cf8) at /srv/build/CURRENT/src/sys/kern/vfs_mount.c:417 #16 0xc06f9157 in syscall (frame=0xcd3a7d38) at /srv/build/CURRENT/src/sys/i386/i386/trap.c:1081 #17 0xc06e1ef0 in Xint0x80_syscall () at /srv/build/CURRENT/src/sys/i386/i386/exception.s:261 Thanks, -- Mateusz Guzik From: Kostik Belousov To: Mateusz Guzik Cc: freebsd-fs@freebsd.org, bug-followup@freebsd.org Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Wed, 6 Aug 2008 17:48:20 +0300 --ltihE5wS63FR6l1A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 06, 2008 at 03:52:24PM +0200, Mateusz Guzik wrote: > Sorry, I don't have currently access to fbsd 7, so here is backtrace > from CURRENT(crashed by mount -o snapshot /somefilesystem): I very much doubt that original submitter has mean this problem. But thanks for noting the issue. I prefer the following change, committed as r181345: diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 5ee123a..4d9754e 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -169,7 +169,8 @@ ffs_mount(struct mount *mp, struct thread *td) * persist "snapshot" in the options list. */ vfs_deleteopt(mp->mnt_optnew, "snapshot"); - vfs_deleteopt(mp->mnt_opt, "snapshot"); + if (mp->mnt_opt !=3D NULL) + vfs_deleteopt(mp->mnt_opt, "snapshot"); } =20 MNT_ILOCK(mp); --ltihE5wS63FR6l1A Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkiZubQACgkQC3+MBN1Mb4jkfwCgg+sP0nON+SXsND0/W1nlJU79 aD4AoOOETOGS1Jf5rv4NWLY0cukGLNeR =Cx00 -----END PGP SIGNATURE----- --ltihE5wS63FR6l1A-- From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kostik Belousov Cc: Mateusz Guzik , freebsd-fs@freebsd.org, bug-followup@freebsd.org Subject: Re: kern/126287: [ufs] [panic] Kernel panics while mounting an UFS filesystem with snapshot enabled Date: Fri, 08 Aug 2008 01:09:11 +0200 Kostik Belousov writes: > @@ -169,7 +169,8 @@ ffs_mount(struct mount *mp, struct thread *td) > * persist "snapshot" in the options list. > */ > vfs_deleteopt(mp->mnt_optnew, "snapshot"); > - vfs_deleteopt(mp->mnt_opt, "snapshot"); > + if (mp->mnt_opt !=3D NULL) > + vfs_deleteopt(mp->mnt_opt, "snapshot"); > } >=20=20 > MNT_ILOCK(mp); I would suggest also adding a KASSERT to vfs_deleteopt(). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no >Unformatted: