Re: [RFC] mount: overwrite options from /etc/fstab when given on the commandline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 01, 2012 at 11:11:41AM +0200, Niels de Vos wrote:
> it seems that some of the options given in /etc/fstab are not overloaded by
> options given on the mount-commandline.

Well, all depends on kernel (and FS driver) how mount options are
evaluated. We have no any strict rules for 'source' and 'mount
options' in the mount(2) syscall.

The generic convention (!= rule) is that the option overwrites an
option previously specified in the mount options string:

    aaa=x,bbb,aaa=y     -> aaa should be 'y'

This is reason why mount(8) only appends the options from command line
to the options string from fstab.

Anyway, depends on FS driver how the options string will be
interpreted -- for example btrfs supports duplicate device= mount
option.


> Some options are not allowed to be
> passed multiple times (like the SElinux context options) and mounting will fail
> if options are present in both /etc/fstab and on the commandline.

This is stupid SELinux disadvantage and SELinux should be fixed.

> Is there a reason for not overloading the options from /etc/fstab by the
> options given on the commandline?
> 
> The patch below changes the behaviour of mount so that options on the
> commandline replace options given in /etc/fstab. 

I'd like to avoid that mount(8) tries to understand filesystem specific
options. The command mount(8) has no clue about the options (non-VFS
options). For example:

fstab:
    /dev/sda    /mnt    btrfs   device=/dev/sdb     0   0

command line:

    mount /mnt -o device=/dev/sdc,device=/dev/sdd


so the final mount options string:

    device=/dev/sdb,device=/dev/sdc,device=/dev/sdd

.. and this all is pretty valid for btrfs.


I'd like to implement for the next release 2.23 a new command line
options to specify a way how compose the final options string in the
mount(8). It's already in our Documentation/TODO file, see
--options-mode, probably something like:

    --options-mode={ignore,append,prepend,replace,dedup}

or so.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux