From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul Menage" Subject: Re: [PATCH] Add MS_BIND_FLAGS mount flag Date: Thu, 14 Feb 2008 08:13:09 -0800 Message-ID: <6599ad830802140813n71b56dccud33e19642a0d7647@mail.gmail.com> References: <47B283EB.8070209@google.com> <6599ad830802140719l270d6fdfyd6d17806eda12a8d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: "Miklos Szeredi" Return-path: Received: from smtp-out.google.com ([216.239.45.13]:36647 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196AbYBNQNP (ORCPT ); Thu, 14 Feb 2008 11:13:15 -0500 Received: from zps77.corp.google.com (zps77.corp.google.com [172.25.146.77]) by smtp-out.google.com with ESMTP id m1EGDCde002688 for ; Thu, 14 Feb 2008 08:13:12 -0800 Received: from wr-out-0506.google.com (wrac47.prod.google.com [10.54.54.47]) by zps77.corp.google.com with ESMTP id m1EGCsdL014997 for ; Thu, 14 Feb 2008 08:13:11 -0800 Received: by wr-out-0506.google.com with SMTP id c47so726484wra.20 for ; Thu, 14 Feb 2008 08:13:09 -0800 (PST) In-Reply-To: Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Feb 14, 2008 at 8:03 AM, Miklos Szeredi wrote: > > The "flags" argument could be the same as for regular mount, and > > contain the mnt_flags - so the extra argument could maybe usefully be > > a "mnt_flags_mask", to indicate which flags we actually care about > > overriding. > > The way I imagined it, is that mnt_flags is a mask, and the operation > (determined by flags) is either: > > - set bits in mask > - clear bits in mask (or not in mask) > - set flags to mask > > It doesn't allow setting some bits, clearing some others, and leaving > alone the rest. But I think such flexibility isn't really needed. I think I'd suggest something like: new_mnt->mnt_flags = (old_mnt->mnt_flags & ~arg_mask) | (arg_flags & mask) > Maybe instead of messing with masks, it's better to introduce a > get_flags() or a more general mount_stat() operation, and let > userspace deal with setting and clearing flags, just as we do for > stat/chmod? > > So we'd have > > mount_stat(path, stat); > mount_bind(from, to, flags); > mount_set_flags(path, flags); > mount_move(from, to); > > and perhaps > > mount_remount(path, opt_string, flags); Sounds reasonable to me. But it wouldn't directly solve the "do a recursive bind mount setting the MS_READONLY flag on all children" problem, so we'd need some of the earlier suggestions too. Paul