From owner-freebsd-current@freebsd.org Wed May 22 23:22:31 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E7DE1590EFB for ; Wed, 22 May 2019 23:22:31 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88EF570390; Wed, 22 May 2019 23:22:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f51.google.com with SMTP id y10so2965294lfl.3; Wed, 22 May 2019 16:22:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QHLm713+G5KCc6B/mKvQ/PGo5hA8qxEF0BmHogSDH0E=; b=NgE0cLib7XjtmXXgiJHLDsePmSpUfoA+4Gf+VEHIR9AN1CpB6JNwF2hJdTqoXHq/hS xFLBaPEnGW+YYg2XgYZDTXf+RKjkTlGRFBCmuKHmLCq/osxqxhQnMRT+Z9+mgi5fSa8z PJpSvmJgaN73E0jfVTXX/HZ4vAbbGXwkOQUnUr7caJ1W6JIRWKSW6kKlWx/j34gii+kv /0+SsFRLnVF1xKnxUNiZ6MxgQleXu7tBP2LESXyglkede2yw/E7iMKYiUa8vt11UnBax d+Hn4/yCGVPBP9WlDwY4ngJ6/2sNSamepruKfyti9Z5hN0wJNDCUI4+I9BUw8Y9BM7oH jirA== X-Gm-Message-State: APjAAAUvfVSiJAlk/+VYSfK/RhiUIUEyfyS53oApBoHiv908KA1Rl8k0 y8nJKOOTm4FBUNl1jIIziQsH0/5njW3yYm1Lq98yfw== X-Google-Smtp-Source: APXvYqxRZECX3vcQrFk0hDomBmNnH4bJk60qqYW0d6iSCOWmz4oHdreBM5nm05o8Q77dn9gEJeP1zbUMd4sXaFg/LjM= X-Received: by 2002:ac2:4d07:: with SMTP id r7mr29660384lfi.142.1558567342779; Wed, 22 May 2019 16:22:22 -0700 (PDT) MIME-Version: 1.0 References: <6ec62e4d-9f93-ffe1-646c-3846c9308334@FreeBSD.org> <20190522175133.GC2748@kib.kiev.ua> <84e3001b-646d-b1d9-f206-577d63f79bf1@FreeBSD.org> <917d2e91-3337-bb29-0103-d6319096a95f@FreeBSD.org> <9dfca165-0cb3-e183-285e-fb41c4870d72@FreeBSD.org> In-Reply-To: <9dfca165-0cb3-e183-285e-fb41c4870d72@FreeBSD.org> From: Alan Somers Date: Wed, 22 May 2019 17:22:10 -0600 Message-ID: Subject: Re: Weirdness when writing to pseudofs file To: Johannes Lundberg Cc: "Conrad E. Meyer" , FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 88EF570390 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.29)[ip: (-0.64), ipnet: 209.85.128.0/17(-3.45), asn: 15169(-2.28), country: US(-0.06)]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.36)[-0.356,0]; RCVD_IN_DNSWL_NONE(0.00)[51.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:22:31 -0000 On Wed, May 22, 2019 at 5:18 PM Johannes Lundberg 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 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