Date: Wed, 22 May 2019 16:33:47 -0700 From: Johannes Lundberg <johalun@FreeBSD.org> To: Alan Somers <asomers@freebsd.org> Cc: "Conrad E. Meyer" <cem@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: Weirdness when writing to pseudofs file Message-ID: <85a70c02-49ae-e394-e7a6-9ad425250a4c@FreeBSD.org> In-Reply-To: <CAOtMX2jVGkw_S2yUkcuoeVxh6f2-PbO5Ab0-S0B2B7n8sPxFYw@mail.gmail.com> References: <6ec62e4d-9f93-ffe1-646c-3846c9308334@FreeBSD.org> <20190522175133.GC2748@kib.kiev.ua> <84e3001b-646d-b1d9-f206-577d63f79bf1@FreeBSD.org> <CAOtMX2i63czMAWmnJik5=gEY=5r4YFhz084zJ8xoThR01POGhQ@mail.gmail.com> <eb0fd852-643d-e399-2988-92de744d6e07@FreeBSD.org> <f1e31c0b-9383-05f9-f1b5-939a586d21d0@FreeBSD.org> <CAG6CVpVwsczJSQjqTMZz2SoPpUxC7O4QkRJ6tfVsmcp%2BHqVYrA@mail.gmail.com> <917d2e91-3337-bb29-0103-d6319096a95f@FreeBSD.org> <9dfca165-0cb3-e183-285e-fb41c4870d72@FreeBSD.org> <CAOtMX2jVGkw_S2yUkcuoeVxh6f2-PbO5Ab0-S0B2B7n8sPxFYw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 5/22/19 4:22 PM, Alan Somers wrote: > On Wed, May 22, 2019 at 5:18 PM Johannes Lundberg <johalun@freebsd.org> wrote: >> >> On 5/22/19 4:12 PM, Johannes Lundberg wrote: >>> On 5/22/19 3:02 PM, Conrad Meyer wrote: >>>> On Wed, May 22, 2019 at 1:58 PM Johannes Lundberg <johalun@freebsd.org> wrote: >>>>>> It seems, a single '>' will cause it to try to create the file (even >>>>>> though it already exists) and that fails (kern_openat). >>>>>> >>>>> I would guess because of >>>>> >>>>> https://github.com/freebsd/freebsd/blob/master/sys/fs/pseudofs/pseudofs_vnops.c#L1042 >>>>> >>>>> struct vop_vector pfs_vnodeops = { >>>>> ... >>>>> .vop_create = VOP_EOPNOTSUPP, >>>>> ... >>>>> } >>>> kern_openat -> vn_open(_cred) should only call VOP_CREATE if namei() >>>> cannot find the named vnode (ni_vp == NULL). Otherwise, it should >>>> just invoke VOP_OPEN. This suggests there might be a lookup bug in >>>> pfs? Tracing VOPs as Mark suggested seems like a good next step. >>>> >>>> Best, >>>> Conrad >>> Thanks Conrad. Yeah, that makes sense that it would open instead of >>> recreating. Tracing a'la Mark points to >>> >>> vop_getwritemount >>> >>> failing. >> Actually vop_setattr also shows up in dtrace. >> >> I'll continue digging.. > vop_setattr would get called to truncate the file's size down to 0. > That's probably called by sh which is opening the file with O_TRUNC. > > -Alan It works if I simply return 0 from pfs_setattr so that's the culprit indeed. Hmm, wonder if there's any elegant solution to this..
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85a70c02-49ae-e394-e7a6-9ad425250a4c>
