Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3431013imm; Mon, 4 Jun 2018 03:35:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIs/06AEz4mL2jHht/iYheNXnciOIYR9riPszn7QzyCT/AhkSdEU7BOW1oq3kBiBhWMAxoD X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr21494326plh.291.1528108547098; Mon, 04 Jun 2018 03:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528108547; cv=none; d=google.com; s=arc-20160816; b=jbKHP8qluDxjAyKXWfDpZIvPJRIXtIf/Pz/DZ35ANcvH/Lbrbav191NCQ/8QMgIFzW 5+zkLjZZ2Uwasosb+7j8tyvQlRxWbZLNJDNQvjDFZ3FW+3oHS9td1lNKAMF2FTbPckQr mgXdsp7Jub5OdiiokLpqHQqST0CEPKnKZg2p+8wTzWz3a1RZ8wREXUFKm22pq2Ty/Slm 8lE/sWImjwTQfhstaqnrqsqaVfJoLI4uscE8WtE2qTe+izproQoulstGv3t55W9yKuwE jwzP0cUoEBZfGB6BWaSnU4oelGBuMMQADBDNhhFYF0jPngZR7RtmUu7t1KCiKwR2HPKY gKEg== 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=5uFYQnUGcuYPVLTkNwEAO67Og9uZBQdlCGzUEh2L/mo=; b=J7dH7QT1PjWXywBUyAtSCW3uSboVDkxmGOPRSHim7mJgrKX9S9EuVifWA6NVfw7Hqt gPkARvORTzIwrO3lbaN/1em6AH+/ScH79/ZXNGhZb3JY7pctIyXywCIIqzSy0mK2i4Lt 0Wy+9IWPVSP9N+8TgLxEze98YjTYObrNED3dLHf164Er0+uY0yNUO9lV4NeUof6z17nD P0ZXGLaEmnvQjQzjpaiVYpr94zH8xo3fTL0sieYpTiGUznqKho84ZJ5cOy94eK+kaSYU DCdhlcgD4vwb+7oHkQVwnvDkO7Hf0F0eET0sD2yRlX05sGuG1+chG6itxLcuQIgj1sSY etcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Uvvx5lh7; 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 t127-v6si3773171pgc.648.2018.06.04.03.35.32; Mon, 04 Jun 2018 03:35:47 -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=Uvvx5lh7; 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 S1752409AbeFDKev (ORCPT + 99 others); Mon, 4 Jun 2018 06:34:51 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:36523 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752341AbeFDKes (ORCPT ); Mon, 4 Jun 2018 06:34:48 -0400 Received: by mail-yw0-f195.google.com with SMTP id v68-v6so10307142ywd.3 for ; Mon, 04 Jun 2018 03:34:47 -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=5uFYQnUGcuYPVLTkNwEAO67Og9uZBQdlCGzUEh2L/mo=; b=Uvvx5lh7Ai+7lZiFGe+VV+xy9x2c9IBTnP3JBwYaUujyC2CfJyf9MhjwBeXnd7u78q KGvEa81fuTCwELgu9L/IluqjbKqIDvDCbHvnbsEswBSBdXM6ATDQrnVPLGc2L7duQMpf wP2gxNtB0XeWiMdBrVgDtfFjJOwaam9Fvx6Co= 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=5uFYQnUGcuYPVLTkNwEAO67Og9uZBQdlCGzUEh2L/mo=; b=rM74sTB4QfadqtJhHKh+dg74lAqK7JrcU42JQY207r1+gTaR9abd63sqmtxgZCgorj 3BjFqjLpltcJ6K6kdgFRdGpLY7SYlWgPNygUcXAtvhN6Idrtm7JLDUJGBI6hVjhkOS5/ e6ODrye5lBJwhyYvh/PATz/CA/a2Sq/N7L5WsRTHPxgoa5PM4VeQzIQusLi4YtNVTRes Sv+CsGYRRcaHDKv8wJurQujjvpfWLU2EH5/7sTGuyWk+b2waOTn1twaZlff0FotcMa1R ctFR+Nbt8Umjmo8Nt5uZd73AhaLTub1Zxa7fon87rG7hzyOD8IqTPMtbHBWMGTdoytYg bL9A== X-Gm-Message-State: ALKqPwcWbrnGy4qo5Zcqkb+ZWRwU4VaqSDEiOCp1TG2DWBv4mp7x4gv6 DyQbAadXlkiM+iw0affx0NqVhg== X-Received: by 2002:a0d:df02:: with SMTP id i2-v6mr10613936ywe.424.1528108487471; Mon, 04 Jun 2018 03:34:47 -0700 (PDT) Received: from mail-yb0-f172.google.com (mail-yb0-f172.google.com. [209.85.213.172]) by smtp.gmail.com with ESMTPSA id z10-v6sm3207870ywg.84.2018.06.04.03.34.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 03:34:45 -0700 (PDT) Received: by mail-yb0-f172.google.com with SMTP id w74-v6so2808892ybe.11; Mon, 04 Jun 2018 03:34:45 -0700 (PDT) X-Received: by 2002:a25:a265:: with SMTP id b92-v6mr2899834ybi.494.1528108485439; Mon, 04 Jun 2018 03:34:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:8503:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 03:34:44 -0700 (PDT) In-Reply-To: <20180603005532.GZ30522@ZenIV.linux.org.uk> References: <20180602040434.GW30522@ZenIV.linux.org.uk> <20180601063928.GS30522@ZenIV.linux.org.uk> <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> From: Miklos Szeredi Date: Mon, 4 Jun 2018 12:34:44 +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: 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 Sun, Jun 3, 2018 at 2:55 AM, Al Viro wrote: > On Sat, Jun 02, 2018 at 06:49:58PM +0100, Al Viro wrote: > >> > > Hell, might even add AT_UMOUNT for "open root and detach, to be dissolved on >> > > close", incompatible with AT_CLONE. >> > >> > Cute. Guess you could do: >> > >> > fd = open_mount(..., OPEN_TREE_DETACH); >> > mount_setattr(fd, "", >> > MOUNT_SETATTR_EMPTY_PATH, >> > MOUNT_SETATTR_NOSUID, NULL); >> > move_mount(fd, "", ...); > > Hadn't added that yet, but as for the rest of open_tree() - see > vfs.git#mount-open_tree. open() and its flags are not touched at all. > Other changes compared to the previous: > * may_mount() is required for OPEN_TREE_CLONE > * sys_ni.c cruft is dropped - those make no sense until and unless > those syscalls become conditional. > > Appears to work, combined with move_mount() it yields eqiuvalents of > mount --{move,bind,rbind}. Combined with mount_setattr(2) (when that > gets added) we'll get mount -o remount,bind,nodev et.al. fsopen = create fsfd fsmount = fsfd -> mountfd & set attr on mountfd & attach mountfd fspick = path -> fsfd move_mount = attach mountfd or move existing fsinfo = info from path open_tree = new mountfd from path or clone mount_setattr = set attr on mountfd Notice that fsmount() encompasses mount_setattr() + move_mount() functionality. Split those out and leave fsmount() to actually do the "fsfd ->mountfd" translation? fsinfo() name suggests it's in the same class as fsopen/fsmount/fspick, operating on fsfd object, but's it's not and I think that's slightly confusing. Rename move_mount() -> mount_move()? Also does it make sense to make the cloning behavior of open_tree() optional? Without cloning it's just a plain open(O_PATH). That way it could be renamed mount_clone(). Thanks, Miklos