Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1309324imm; Fri, 1 Jun 2018 21:11:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIOdFpXfWiSdlk4tBK+1a4JgY1j7ArHMDy1EGtIliv0lSQDgmly46/e9pXm6UUMdZuNMcNm X-Received: by 2002:a62:9bc9:: with SMTP id e70-v6mr9896355pfk.15.1527912667626; Fri, 01 Jun 2018 21:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527912667; cv=none; d=google.com; s=arc-20160816; b=JEqcKmMiEf+6l1z1Wyo2F6bAlFlcz9vKqE/pOyZxHFLRC7vJKc5IyQ5YNmwrv1qavB xVIViieHQqM6PSd+2sTYSpT0MBnDqoCe9ho5RWifovbyXK1VTahBWJi5BeY52MlR9kpT pjKCc+YS6ej3jQ2d5eTVGy3k0AYhyBYxVzy34w8rUFrlFvMe5kL+F3GdGzFQ41BJnyxH B4LBRyGwFlIkhAL63tb/b9rrHEM3UWk1rGueZQxieW1epVR6EEIwT1kYQpFxOXItiP2H 9D1w2mZiwTKM1y0jqeu9MW+thEjGCm07RJzL9Mfy/PmvxYYwWdE+myMz2ve1+Hvd+bCx MjNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=aDyqqwlhgnOd7wyqVyi0e99CEdqOECwUN13EUWfns5M=; b=MzJs8RFDrdM/qHA/5n6DOM8CZWD+RcRgEsqcYtERpo40tKvtkY55fT1VZRpzkl7yVf P1n20rXNP+3af92N/nZBIG7rrsvu7RmXV0TDc+EwppcJ2mjHCGlstYz06tvDPwCaLmos Hs43IpLBfwkFbP0rFPkERNYPGnuCrpHZ7V9CojSNUQ0R4n5t+ZujWJMx5htVBcO9oFpI slPKKheRq88P9fPka/dQsU3XHy6oRSfH4W6CXS6XEmMsUh/jrPnbPCIRKlhYKiDHS8Pm 8pvF/sYCMRzwsH/df+ICAJqko+1ZRj0fLbojjSClPBcByGglaydZ6PzOwX2lfII4MkTW JivA== ARC-Authentication-Results: i=1; mx.google.com; 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 y14-v6si1535288plr.30.2018.06.01.21.10.15; Fri, 01 Jun 2018 21:11:07 -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; 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 S1750927AbeFBEEj (ORCPT + 99 others); Sat, 2 Jun 2018 00:04:39 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:35154 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbeFBEEi (ORCPT ); Sat, 2 Jun 2018 00:04:38 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fOxmM-0003SK-Jh; Sat, 02 Jun 2018 04:04:34 +0000 Date: Sat, 2 Jun 2018 05:04:34 +0100 From: Al Viro To: David Howells Cc: Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH 30/32] vfs: Allow cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8] Message-ID: <20180602040434.GW30522@ZenIV.linux.org.uk> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180602034255.GV30522@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 02, 2018 at 04:42:56AM +0100, Al Viro wrote: > _If_ I'm interpreting that correctly, that should be something like a bitmap > of attributes to modify + values to set for each. Let's see - > propagation 1 + 2 bits > nodev 1 + 1 > noexec 1 + 1 > nosuid 1 + 1 > ro 1 + 1 > atime 1 + 3 > That's 15 bits. On top of that, we have 1 bit for "clone or original" > and 1 bit for "recursive or single-mount". As well as AT_EMPTY_PATH, > and AT_NO_AUTOMOUNT (inconvenient, since these are fixed bits). In > principle, that does fit into int, with some space to spare... > > Is that what you have in mind? TBH, I would probably prefer separate mount_setattr(2) for that kind of work, with something like int mount_setattr(int dirfd, const char *path, int flags, int attr) *not* opening any files. flags: AT_EMPTY_PATH, AT_NO_AUTOMOUNT, AT_RECURSIVE attr: MOUNT_SETATTR_DEV (1<<0) MOUNT_SETATTR_NODEV (1<<0)|(1<<1) MOUNT_SETATTR_EXEC (1<<2) MOUNT_SETATTR_NOEXEC (1<<2)|(1<<3) MOUNT_SETATTR_SUID (1<<4) MOUNT_SETATTR_NOSUID (1<<4)|(1<<5) MOUNT_SETATTR_RW (1<<6) MOUNT_SETATTR_RO (1<<6)|(1<<7) MOUNT_SETATTR_RELATIME (1<<8) MOUNT_SETATTR_NOATIME (1<<8)|(1<<9) MOUNT_SETATTR_NODIRATIME (1<<8)|(2<<9) MOUNT_SETATTR_STRICTATIME (1<<8)|(3<<9) MOUNT_SETATTR_PRIVATE (1<<11) MOUNT_SETATTR_SHARED (1<<11)|(1<<12) MOUNT_SETATTR_SLAVE (1<<11)|(2<<12) MOUNT_SETATTR_UNBINDABLE (1<<11)|(3<<12) With either openat() used as in this series, or explicit int open_tree(int dirfd, const char *path, int flags) returning a descriptor, with flags being AT_EMPTY_PATH, AT_NO_AUTOMOUNT, AT_RECURSIVE, AT_CLONE with AT_RECURSIVE without AT_CLONE being an error. Hell, might even add AT_UMOUNT for "open root and detach, to be dissolved on close", incompatible with AT_CLONE. Comments?