From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from imap.thunk.org ([74.207.234.97]:47276 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725762AbeIZE4G (ORCPT ); Wed, 26 Sep 2018 00:56:06 -0400 Date: Tue, 25 Sep 2018 18:46:13 -0400 From: "Theodore Y. Ts'o" To: Adam Borowski Cc: Jeff Layton , Alan Cox , =?utf-8?B?54Sm5pmT5Yas?= , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Rogier Wolff Subject: Re: POSIX violation by writeback error Message-ID: <20180925224613.GI2933@thunk.org> References: <486f6105fd4076c1af67dae7fdfe6826019f7ff4.camel@redhat.com> <20180925003044.239531c7@alans-desktop> <0662a4c5d2e164d651a6a116d06da380f317100f.camel@redhat.com> <20180925154627.GC2933@thunk.org> <20180925173510.273hshp4iapd6dcd@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925173510.273hshp4iapd6dcd@angband.pl> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Sep 25, 2018 at 07:35:11PM +0200, Adam Borowski wrote: > Isn't this what the snippet for O_TMPFILE in "man 2 open" does?: > > char path[PATH_MAX]; > fd = open("/path/to/dir", O_TMPFILE | O_RDWR, > S_IRUSR | S_IWUSR); > > /* File I/O on 'fd'... */ > > snprintf(path, PATH_MAX, "/proc/self/fd/%d", fd); > linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file", > AT_SYMLINK_FOLLOW); Huh. I stand corrected. I had assumed O_TMPFILE worked like any other file where the link count was zero, and linkat(2) wouldn't allow this. But obviously, this does work. In fact, from the linkat(2) man page, using: linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH); is an even simpler way that doesn't /proc being mounted. TIL... - Ted