Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp41343imm; Mon, 4 Jun 2018 12:38:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKolPrlsA90qiP3EIeDB3GciUB+qRml6ZLr/vPPXsb8yZspt7Brq+eia1dntqk8aWMCKCAU X-Received: by 2002:a17:902:1c7:: with SMTP id b65-v6mr23086050plb.298.1528141131927; Mon, 04 Jun 2018 12:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528141131; cv=none; d=google.com; s=arc-20160816; b=05/wT1LN/FEjb6+xNLlzQvQBJYtGQMzwEB3zw4VMDusC9dIoeqlvrKMbYIXHjX5NOt aJwThnDV1f+FfMaYI+ZhMsuCv9jfT7rkVWiB31M4zdllqswsWTWYqLCUDF4Fk/7YoZTp 6WrGa+jgel6p5odfH0N/RY0hv627pZurKor04+qL2uCXnvDqlO+vQoJUTf8ELYYtJ+A9 aDt0rRY6Q2N6gnlmGRhTgFD18NFvr0AZyOehmwBLzcmUS6hwD/cy97gY54DoLpJI1ozU td1rXbFXg5o8b8UErKYnYvqnZTDs8WYVfsmg0qJUnxM13KJEDDLDoWEiLJwLdtVKksvI rUDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=P8MXpRayNOQ6k+1OQwDYWhDVRFThxl4nnz9Up79QcH4=; b=WAU6WK56v9ddYyJCdQEMOO4YiS/PRV7RJozot1n/Xb5R02EGFZSkWDcVW50niNPb+X 8SPLpmHf5Nd18hQq17T9V3VH/LozrNGTM0AkVDc5jyCQjSICObo9LZvSIYsryhDiGELp ruL7jJMrZANfRcn5UL4MoLdTFyruCjeNQRCDPdyU8je+6JKoN8I32R2ryMF1qDYN2c6Y VGUIcanFbZj4TCp45zdrb0OdKKkbBAXMG3NgppuOi0MCTOUYiNKvWrtGxh0YlC5clBiX qq3RdBpTmo4etya6PgdVf2Syd4pB+Va+nHm/1peAlX1WdmKAufWPHIy0iPwGoqcRZd3Q fBvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=huUpO2lD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si2445342pgn.0.2018.06.04.12.38.36; Mon, 04 Jun 2018 12:38:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=huUpO2lD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263AbeFDTiF (ORCPT + 99 others); Mon, 4 Jun 2018 15:38:05 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:43002 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbeFDTiD (ORCPT ); Mon, 4 Jun 2018 15:38:03 -0400 Received: by mail-yw0-f196.google.com with SMTP id q7-v6so10897549ywd.9 for ; Mon, 04 Jun 2018 12:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=P8MXpRayNOQ6k+1OQwDYWhDVRFThxl4nnz9Up79QcH4=; b=huUpO2lDZU5rrEoHcmz5OCQzKSo4qmqEK0zirdgIF6s00QzXO5lG/LPUVk7E+Thts3 4fa67tgplS0PXmCEjIqCmFazTePPOPR0VLvdIl174H9SrKj2TEDBx8tSSwzlp3F1vw6q S0LFVKCB4EDl8gjOczYdFd+pg7hoiJ74LpjOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=P8MXpRayNOQ6k+1OQwDYWhDVRFThxl4nnz9Up79QcH4=; b=aAuYZdeVD2IiSY1mSbxUtVWZia+WUoqm/IhH7Sn6UaDFFOpQU+AgpqhivinwdTqALf DUpSYgEYtvKiObrpwHDX9gKrJld51W6gx8ImzYLrGewz7Ty2G+9w5kLpbnsoA3lOCXMy 09mMktbuoyREXy6Db2wxO4tyo43F2Ot3dUqZVDJGEnv0G484m8cvW0YrFtZmbYoJ4mEm DYAN84RhhSInS8uhS9acfYMNILdJVIaHA2AiZY1cmznMilynP7Z6KyVqzBOnXWuc+NVo Az+8fJ7fAFQa3sB+QpuFRkWypXQm672FX2b5N0Rh32RfoBLIEgjptA3/b8ETH3N3pj5D rWZw== X-Gm-Message-State: ALKqPwfMz4Ulq6AputeGfZqjDv5ALNjbKd7r85oA91y1XWZgLjRot2vh 5uK7QsxwisjtYuiqV7gnyXbG9cSK X-Received: by 2002:a81:5dc1:: with SMTP id r184-v6mr11407007ywb.159.1528141082913; Mon, 04 Jun 2018 12:38:02 -0700 (PDT) Received: from mail-yb0-f171.google.com (mail-yb0-f171.google.com. [209.85.213.171]) by smtp.gmail.com with ESMTPSA id g32-v6sm5567720ywk.15.2018.06.04.12.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 12:38:01 -0700 (PDT) Received: by mail-yb0-f171.google.com with SMTP id l2-v6so11435270ybp.8; Mon, 04 Jun 2018 12:38:01 -0700 (PDT) X-Received: by 2002:a25:cdc9:: with SMTP id d192-v6mr7615861ybf.325.1528141081161; Mon, 04 Jun 2018 12:38:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:8503:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 12:38:00 -0700 (PDT) In-Reply-To: <20180604173508.GJ30522@ZenIV.linux.org.uk> References: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720691829.9073.10564431140980997005.stgit@warthog.procyon.org.uk> <20180601062654.GA32397@infradead.org> <7067.1527841663@warthog.procyon.org.uk> <20180602030913.GU30522@ZenIV.linux.org.uk> <20180602034255.GV30522@ZenIV.linux.org.uk> <21804.1527954321@warthog.procyon.org.uk> <20180602174957.GX30522@ZenIV.linux.org.uk> <20180603005532.GZ30522@ZenIV.linux.org.uk> <20180604171630.GA29059@bombadil.infradead.org> <20180604173508.GJ30522@ZenIV.linux.org.uk> From: Miklos Szeredi Date: Mon, 4 Jun 2018 21:38:00 +0200 X-Gmail-Original-Message-ID: Message-ID: 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]) To: Al Viro Cc: Matthew Wilcox , David Howells , Christoph Hellwig , linux-fsdevel , linux-afs@lists.infradead.org, LKML , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 4, 2018 at 7:35 PM, Al Viro 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