Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Mar 2022 04:03:46 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        John Baldwin <jhb@FreeBSD.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: ktrace on NFSroot failing?
Message-ID:  <YT2PR01MB973039BE3072ED3F94CFE141DD1B9@YT2PR01MB9730.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <YT2PR01MB97308688D7ACB6072A20DBE8DD1B9@YT2PR01MB9730.CANPRD01.PROD.OUTLOOK.COM>
References:  <alpine.BSF.2.00.2203101514090.68830@ai.fobar.qr> <CAGudoHGCOVQy7CVySkNKey0QYi2zqO8UqBUcACzmWH4B-ZpsuQ@mail.gmail.com> <70135754-84c2-b642-5641-0721e0b4690d@FreeBSD.org> <YT2PR01MB97308688D7ACB6072A20DBE8DD1B9@YT2PR01MB9730.CANPRD01.PROD.OUTLOOK.COM>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Rick Macklem <rmacklem@uoguelph.ca> wrote:
> John Baldwin <jhb@FreeBSD.org> wrote:
> > On 3/10/22 8:14 AM, Mateusz Guzik wrote:
> > > On 3/10/22, Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net> wrote:
> > >> Hi,
> > >>
> > >> I am having a weird issue with ktrace on an nfsroot machine:
> > >>
> > >> root:/tmp # ktrace sleep 1
> > >> root:/tmp # kdump
> > >> -559038242  Events dropped.
> > >> kdump: bogus length 0xdeadc0de
> > >>
> > >> Anyone seen something like this before?
> > >>
> > >
> > > I just did a quick check and it definitely fails on nfs mounts:
> > > # ktrace pwd
> > > /root/mjg
> > > # kdump
> > > -559038242  Events dropped.
> > > kdump: bogus length 0xdeadc0de
> > >
> > > I don't have time to look into it this week though.
> >
> > Possibly related: core dumps are no longer working for me on NFS
> > mounts.  I get a 0 byte foo.core instead of a valid core dump.
> I just tried a core dump for a kernel built from main sources as of
> to-day and it worked ok.
> 
> However my userland is several months old and I can't easily upgrade
> it for now.
>
> There was a recent ZFS problem that found its way into 13.0-p8 that
> I'm pretty sure is fixed now. If you had a fairly recent server exporting
> ZFS, that *might* explain it?
> 
> In particular, an NFSroot uses NFSv3 and nothing has changed for
> NFSv3 in a looonnggg time.
Oops, I did make a change that affected NFSv3 as well as NFSv4.
Last December I committed a path to head that made IO_APPEND
writes use nfs_directio_write() and avoid the buffer cache.

Turns out nfs_directio_write() only worked for UIO_USERSPACE.
The attached trivial patch fixes ktrace for me.
I have no idea if core dumping ever does IO_APPEND VOP_WRITE()s?

Please test the attached patch.

Thanks, rick

rick

--
John Baldwin


[-- Attachment #2 --]
--- sys/fs/nfsclient/nfs_clbio.c.sav	2022-03-25 19:36:58.381558000 -0700
+++ sys/fs/nfsclient/nfs_clbio.c	2022-03-25 19:44:15.386469000 -0700
@@ -780,7 +780,7 @@ do_sync:
 			uio.uio_iovcnt = 1;
 			uio.uio_offset = uiop->uio_offset;
 			uio.uio_resid = size;
-			uio.uio_segflg = UIO_USERSPACE;
+			uio.uio_segflg = uiop->uio_segflg;
 			uio.uio_rw = UIO_WRITE;
 			uio.uio_td = td;
 			iomode = NFSWRITE_FILESYNC;
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YT2PR01MB973039BE3072ED3F94CFE141DD1B9>