[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAELBmZARJVUMhPC2w-RFic=6r7tcrJYGV4Yt03xxZXsKr+FR1w@mail.gmail.com>
Date: Mon, 4 Jun 2018 21:38:00 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Matthew Wilcox <willy@...radead.org>,
David Howells <dhowells@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-afs@...ts.infradead.org, LKML <linux-kernel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>
Subject: Re: [PATCH][RFC] open_tree(2) (was Re: [PATCH 30/32] vfs: Allow
cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8])
On Mon, Jun 4, 2018 at 7:35 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
> On Mon, Jun 04, 2018 at 10:16:30AM -0700, Matthew Wilcox wrote:
>> On Sun, Jun 03, 2018 at 01:55:37AM +0100, Al Viro wrote:
>> > +SYSCALL_DEFINE3(open_tree, int, dfd, const char *, filename, unsigned, flags)
>> > +{
>> > + struct file *file;
>> > + struct path path;
>> > + int lookup_flags = LOOKUP_AUTOMOUNT | LOOKUP_FOLLOW;
>> > + bool detached = flags & OPEN_TREE_CLONE;
>> > + int error;
>> > + int fd;
>> > +
>> > + BUILD_BUG_ON(OPEN_TREE_CLOEXEC != O_CLOEXEC);
>>
>> Why do we need OPEN_TREE_CLOEXEC? Wouldn't we be better off just making
>> the fd returned by open_tree implicitly close-on-exec? I can think of
>> no good reason for these file descriptors to be inherited across exec()
>
> How are they different from any file descriptor? It's not as if it was
> something usable only for mounting stuff - again, you can use them
> with any ...at() syscalls.
Defaulting to close on exec helps keep out clutter from the API.
Is there a disadvantage to needing an explicit fcntl(F_SETFD) call to
disable close on exec?
Thanks,
Miklos
Powered by blists - more mailing lists