Date: Tue, 6 May 2014 00:50:00 GMT From: "Steven Hartland" <killing@multiplay.co.uk> To: freebsd-fs@FreeBSD.org Subject: Re: kern/189355: [zfs] zfs panic on root mount 10-stable Message-ID: <201405060050.s460o0Ru070369@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/189355; it has been noted by GNATS. From: "Steven Hartland" <killing@multiplay.co.uk> To: <bug-followup@freebsd.org>, <hsn@sendmail.cz> Cc: Subject: Re: kern/189355: [zfs] zfs panic on root mount 10-stable Date: Tue, 6 May 2014 01:44:29 +0100 This is a multi-part message in MIME format. ------=_NextPart_000_0300_01CF68CC.B8749960 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit Can you try building a debug kernel with the attached patch. It should allow you to configure a dump device before the root device is mounted by specifying it in /boot/loader.conf kern.shutdown.defaultdumpdev="ada4p3" Ensure you choose a valid device such a swap device. If all goes well that will enable you to get a proper stack trace from the dump. Regards Steve ------=_NextPart_000_0300_01CF68CC.B8749960 Content-Type: application/octet-stream; name="default-dump-dev.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="default-dump-dev.patch" Quick patch which configures kernel dump location prior to mounting root.=0A= =0A= The location is controlled by the new tunable:=0A= kern.shutdown.defaultdumpdev=0A= =0A= An example of configuring it would be to add the following to = /boot/loader.conf:=0A= kern.shutdown.defaultdumpdev=3D"ada4p3"=0A= =0A= This would configure kernel dumps on ata disk 4 partition 3.=0A= =0A= The usual rules should be maintained when picking a device i.e. choose a = device=0A= use for swap or otherwise unused.=0A= --- sys/kern/kern_shutdown.c.orig 2014-05-04 23:37:01.954116628 +0000=0A= +++ sys/kern/kern_shutdown.c 2014-05-06 00:28:54.591101862 +0000=0A= @@ -50,12 +50,14 @@ __FBSDID("$FreeBSD: releng/10.0/sys/kern=0A= #include <sys/conf.h>=0A= #include <sys/cons.h>=0A= #include <sys/eventhandler.h>=0A= +#include <sys/fcntl.h>=0A= #include <sys/jail.h>=0A= #include <sys/kdb.h>=0A= #include <sys/kernel.h>=0A= #include <sys/kerneldump.h>=0A= #include <sys/kthread.h>=0A= #include <sys/ktr.h>=0A= +#include <sys/limits.h>=0A= #include <sys/malloc.h>=0A= #include <sys/mount.h>=0A= #include <sys/priv.h>=0A= @@ -72,6 +74,9 @@ __FBSDID("$FreeBSD: releng/10.0/sys/kern=0A= =0A= #include <ddb/ddb.h>=0A= =0A= +#include <fs/devfs/devfs_int.h>=0A= +#include <geom/geom.h>=0A= +=0A= #include <machine/cpu.h>=0A= #include <machine/pcb.h>=0A= #include <machine/smp.h>=0A= @@ -245,6 +250,72 @@ print_uptime(void)=0A= printf("%lds\n", (long)ts.tv_sec);=0A= }=0A= =0A= +static char defaultdumpdev[MAXPATHLEN];=0A= +TUNABLE_STR("kern.shutdown.defaultdumpdev", defaultdumpdev,=0A= + sizeof(defaultdumpdev));=0A= +SYSCTL_STRING(_kern_shutdown, OID_AUTO, defaultdumpdev, CTLFLAG_RDTUN,=0A= + defaultdumpdev, 0, "Default device for early kernel dumps");=0A= +=0A= +int=0A= +setdumpdev(char *devname)=0A= +{=0A= + struct thread *td =3D curthread;=0A= + int error, i, ref;=0A= + struct g_consumer *cp;=0A= + struct g_kerneldump kd;=0A= + struct cdev_priv *cdp;=0A= + struct cdev *dev;=0A= + struct cdevsw *dsw;=0A= +=0A= + if (devname =3D=3D NULL || strlen(devname) =3D=3D 0)=0A= + return (set_dumper(NULL, NULL));=0A= +=0A= + dev =3D NULL;=0A= + dev_lock();=0A= + TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) {=0A= + dev =3D &cdp->cdp_c;=0A= + if (strcmp(dev->si_name, devname) =3D=3D 0)=0A= + break;=0A= + dev =3D NULL;=0A= + }=0A= + dev_unlock();=0A= +=0A= + if (dev =3D=3D NULL)=0A= + return (ENOENT);=0A= +=0A= + dsw =3D dev_refthread(dev, &ref);=0A= + if (dsw =3D=3D NULL)=0A= + return (ENXIO);=0A= +=0A= + error =3D dsw->d_open(dev, FREAD, 0, td);=0A= + if (error !=3D 0) {=0A= + dev_relthread(dev, ref);=0A= + return (error);=0A= + }=0A= +=0A= + cp =3D dev->si_drv2;=0A= + kd.offset =3D 0;=0A= + kd.length =3D OFF_MAX;=0A= + i =3D sizeof(kd);=0A= + error =3D g_io_getattr("GEOM::kerneldump", cp, &i, &kd);=0A= + if (error =3D=3D 0) {=0A= + error =3D set_dumper(&kd.di, devtoname(dev));=0A= + if (error =3D=3D 0)=0A= + dev->si_flags |=3D SI_DUMPDEV;=0A= + }=0A= +=0A= + (void)dev->si_devsw->d_close(dev, FREAD, 0, td);=0A= + dev_relthread(dev, ref);=0A= +=0A= + return (error);=0A= +}=0A= +=0A= +int=0A= +setdumpdev_default(void)=0A= +{=0A= + return (setdumpdev(defaultdumpdev));=0A= +}=0A= +=0A= int=0A= doadump(boolean_t textdump)=0A= {=0A= --- sys/kern/init_main.c.orig 2014-05-05 18:06:24.008837474 +0000=0A= +++ sys/kern/init_main.c 2014-05-05 22:39:52.964175470 +0000=0A= @@ -697,6 +697,8 @@ start_init(void *dummy)=0A= struct thread *td;=0A= struct proc *p;=0A= =0A= + setdumpdev_default();=0A= +=0A= mtx_lock(&Giant);=0A= =0A= GIANT_REQUIRED;=0A= --- sys/sys/conf.h.orig 2014-05-05 02:20:24.408440686 +0000=0A= +++ sys/sys/conf.h 2014-05-05 15:21:06.150967151 +0000=0A= @@ -338,6 +338,8 @@ int set_dumper(struct dumperinfo *, cons=0A= int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);=0A= void dumpsys(struct dumperinfo *);=0A= int doadump(boolean_t);=0A= +int setdumpdev_default(void);=0A= +int setdumpdev(char *);=0A= extern int dumping; /* system is dumping */=0A= =0A= #endif /* _KERNEL */=0A= ------=_NextPart_000_0300_01CF68CC.B8749960--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405060050.s460o0Ru070369>