Re: ktrace on NFSroot failing?

From: Rick Macklem <rmacklem_at_uoguelph.ca>
Date: Sat, 26 Mar 2022 04:03:46 UTC
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