Skip to content

Commit 60d6d04

Browse files
raven-autorvalds
authored andcommitted
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>
1 parent 8496ecd commit 60d6d04

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎fs/autofs/autofs_i.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ struct autofs_wait_queue {
105105

106106
#define AUTOFS_SBI_CATATONIC 0x0001
107107
#define AUTOFS_SBI_STRICTEXPIRE 0x0002
108+
#define AUTOFS_SBI_IGNORE 0x0004
108109

109110
struct autofs_sb_info {
110111
u32 magic;

‎fs/autofs/inode.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static int autofs_show_options(struct seq_file *m, struct dentry *root)
8989
seq_printf(m, ",indirect");
9090
if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
9191
seq_printf(m, ",strictexpire");
92+
if (sbi->flags & AUTOFS_SBI_IGNORE)
93+
seq_printf(m, ",ignore");
9294
#ifdef CONFIG_CHECKPOINT_RESTORE
9395
if (sbi->pipe)
9496
seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
@@ -111,7 +113,8 @@ static const struct super_operations autofs_sops = {
111113
};
112114

113115
enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
114-
Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire};
116+
Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire,
117+
Opt_ignore};
115118

116119
static const match_table_t tokens = {
117120
{Opt_fd, "fd=%u"},
@@ -124,6 +127,7 @@ static const match_table_t tokens = {
124127
{Opt_direct, "direct"},
125128
{Opt_offset, "offset"},
126129
{Opt_strictexpire, "strictexpire"},
130+
{Opt_ignore, "ignore"},
127131
{Opt_err, NULL}
128132
};
129133

@@ -206,6 +210,9 @@ static int parse_options(char *options,
206210
case Opt_strictexpire:
207211
sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
208212
break;
213+
case Opt_ignore:
214+
sbi->flags |= AUTOFS_SBI_IGNORE;
215+
break;
209216
default:
210217
return 1;
211218
}

‎include/uapi/linux/auto_fs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define AUTOFS_MIN_PROTO_VERSION 3
2424
#define AUTOFS_MAX_PROTO_VERSION 5
2525

26-
#define AUTOFS_PROTO_SUBVERSION 4
26+
#define AUTOFS_PROTO_SUBVERSION 5
2727

2828
/*
2929
* The wait_queue_token (autofs_wqt_t) is part of a structure which is passed

0 commit comments

Comments
 (0)