From owner-freebsd-current@freebsd.org Wed May 22 20:53:32 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 3B26015B709C for ; Wed, 22 May 2019 20:53:32 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72FEB69A8A; Wed, 22 May 2019 20:53:31 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from [10.46.14.95] (wsip-72-212-151-146.ph.ph.cox.net [72.212.151.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: johalun) by smtp.freebsd.org (Postfix) with ESMTPSA id ADED514C84; Wed, 22 May 2019 20:53:30 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Subject: Re: Weirdness when writing to pseudofs file To: Alan Somers Cc: Konstantin Belousov , FreeBSD Current References: <6ec62e4d-9f93-ffe1-646c-3846c9308334@FreeBSD.org> <20190522175133.GC2748@kib.kiev.ua> <84e3001b-646d-b1d9-f206-577d63f79bf1@FreeBSD.org> From: Johannes Lundberg X-Tagtoolbar-Keys: D20190522135329121 Message-ID: Date: Wed, 22 May 2019 13:53:29 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 72FEB69A8A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] 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 20:53:32 -0000 On 5/22/19 11:03 AM, Alan Somers wrote: > On Wed, May 22, 2019 at 11:59 AM Johannes Lundberg wrote: >> >> On 5/22/19 10:51 AM, Konstantin Belousov wrote: >>> On Wed, May 22, 2019 at 10:36:34AM -0700, Johannes Lundberg wrote: >>>> Hi >>>> >>>> I'm fiddling with lindebugfs, which is based on pseudofs. When writing >>>> to a file, >>>> >>>> this works: # echo 1 >> /path/to/file >>>> >>>> but this does not: # echo 1 > /path/to/file >>>> >>>> "Operation not supported." is returned before the pseudofs code is even >>>> entered. >>>> >>>> Is this expected behavior? (if so, why?) >>> Does the file exist ? >>> >>> Pseudofs does not implement VOP_CREATE(), which is reasonable. >> Yes, it exists and my custom write function is receiving the call for >> ">>". (which is for example used by drm driver debugfs to do certain >> things on demand by accepting write to a debugfs file) > First, you need to try ktrace to see exactly which system call is not > supported. If the problem still isn't obvious, then you can try > dtrace to see exactly which VOP isn't suppoted. Do it like this: > > sudo ktrace /bin/sh -c "echo 1 > /path/to/file" > sudo kdump > sudo dtrace -i 'fbt:::return /arg1 == 45/ {trace(".")}' -c "/bin/sh -c > 'echo 1 > /path/to/file/'" > > The dtrace command will show you which function returned EOPNOTSUPP. > However, it will also show a lot of functions that coincidentally > return 45 even though it's not an errno, and even functions that > return void. > > -Alan Thanks! It seems, a single '>' will cause it to try to create the file (even though it already exists) and that fails (kern_openat).