Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

autofs: add ignore mount option

Add an autofs file system mount option that can be used to provide a
generic indicator to applications that the mount entry should be ignored
when displaying mount information.

In other OSes that provide autofs and that provide a mount list to user
space based on the kernel mount list a no-op mount option ("ignore" is
the one use on the most common OS) is allowed so that autofs file system
users can optionally use it.

The idea is that it be used by user space programs to exclude autofs
mounts from consideration when reading the mounts list.

Prior to the change to link /etc/mtab to /proc/self/mounts all I needed
to do to achieve this was to use mount(2) and not update the mtab but
now that no longer works.

I know the symlinking happened a long time ago and I considered doing
this then but, at the time I couldn't remember the commonly used option
name and thought persuading the various utility maintainers would be too
hard.

But now I have a RHEL request to do this for compatibility for a widely
used product so I want to go ahead with it and try and enlist the help
of some utility package maintainers.

Clearly, without the option nothing can be done so it's at least a
start.

Link: http://lkml.kernel.org/r/154725123970.11260.6113771566924907275.stgit@pluto-themaw-net
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ian Kent and committed by
Linus Torvalds
60d6d04c 8496ecd0

+10 -2
+1
fs/autofs/autofs_i.h
··· 105 105 106 106 #define AUTOFS_SBI_CATATONIC 0x0001 107 107 #define AUTOFS_SBI_STRICTEXPIRE 0x0002 108 + #define AUTOFS_SBI_IGNORE 0x0004 108 109 109 110 struct autofs_sb_info { 110 111 u32 magic;
+8 -1
fs/autofs/inode.c
··· 89 89 seq_printf(m, ",indirect"); 90 90 if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE) 91 91 seq_printf(m, ",strictexpire"); 92 + if (sbi->flags & AUTOFS_SBI_IGNORE) 93 + seq_printf(m, ",ignore"); 92 94 #ifdef CONFIG_CHECKPOINT_RESTORE 93 95 if (sbi->pipe) 94 96 seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino); ··· 113 111 }; 114 112 115 113 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto, 116 - Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire}; 114 + Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire, 115 + Opt_ignore}; 117 116 118 117 static const match_table_t tokens = { 119 118 {Opt_fd, "fd=%u"}, ··· 127 124 {Opt_direct, "direct"}, 128 125 {Opt_offset, "offset"}, 129 126 {Opt_strictexpire, "strictexpire"}, 127 + {Opt_ignore, "ignore"}, 130 128 {Opt_err, NULL} 131 129 }; 132 130 ··· 209 205 break; 210 206 case Opt_strictexpire: 211 207 sbi->flags |= AUTOFS_SBI_STRICTEXPIRE; 208 + break; 209 + case Opt_ignore: 210 + sbi->flags |= AUTOFS_SBI_IGNORE; 212 211 break; 213 212 default: 214 213 return 1;
+1 -1
include/uapi/linux/auto_fs.h
··· 23 23 #define AUTOFS_MIN_PROTO_VERSION 3 24 24 #define AUTOFS_MAX_PROTO_VERSION 5 25 25 26 - #define AUTOFS_PROTO_SUBVERSION 4 26 + #define AUTOFS_PROTO_SUBVERSION 5 27 27 28 28 /* 29 29 * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed