Re: [PATCH] Add MS_BIND_FLAGS mount flag

From: Paul Menage
Date: Thu Feb 14 2008 - 11:13:32 EST


On Thu, Feb 14, 2008 at 8:03 AM, Miklos Szeredi <miklos@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/