History

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.

Ian Kent committed 7 years ago

Commit 60d6d041 parent 8496ecd3 files · +10 −2Browse files

Unified · Split

3 files
  1. fs/autofs/autofs_i.h +1 −0
  2. fs/autofs/inode.c +8 −1
  3. include/uapi/linux/auto_fs.h +1 −1
fs/autofs/autofs_i.h+1−0
@@ -105,6 +105,7 @@ struct autofs_wait_queue { · 104 unmodified lines
105 105
106#define AUTOFS_SBI_CATATONIC 0x0001106#define AUTOFS_SBI_CATATONIC 0x0001
107#define AUTOFS_SBI_STRICTEXPIRE 0x0002107#define AUTOFS_SBI_STRICTEXPIRE 0x0002
108#define AUTOFS_SBI_IGNORE 0x0004
108 109
109struct autofs_sb_info {110struct autofs_sb_info {
110 u32 magic;111 u32 magic;
fs/autofs/inode.c+8−1
@@ -89,6 +89,8 @@ static int autofs_show_options(struct seq_file *m, struct dentry *root) · 88 unmodified lines
89 seq_printf(m, ",indirect");89 seq_printf(m, ",indirect");
90 if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)90 if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
91 seq_printf(m, ",strictexpire");91 seq_printf(m, ",strictexpire");
92 if (sbi->flags & AUTOFS_SBI_IGNORE)
93 seq_printf(m, ",ignore");
92#ifdef CONFIG_CHECKPOINT_RESTORE94#ifdef CONFIG_CHECKPOINT_RESTORE
93 if (sbi->pipe)95 if (sbi->pipe)
94 seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);96 seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
@@ -111,7 +113,8 @@ static const struct super_operations autofs_sops = { · 16 unmodified lines
111};113};
112 114
113enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,115enum {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};
115 118
116static const match_table_t tokens = {119static const match_table_t tokens = {
117 {Opt_fd, "fd=%u"},120 {Opt_fd, "fd=%u"},
@@ -124,6 +127,7 @@ static const match_table_t tokens = { · 6 unmodified lines
124 {Opt_direct, "direct"},127 {Opt_direct, "direct"},
125 {Opt_offset, "offset"},128 {Opt_offset, "offset"},
126 {Opt_strictexpire, "strictexpire"},129 {Opt_strictexpire, "strictexpire"},
130 {Opt_ignore, "ignore"},
127 {Opt_err, NULL}131 {Opt_err, NULL}
128};132};
129 133
@@ -206,6 +210,9 @@ static int parse_options(char *options, · 76 unmodified lines
206 case Opt_strictexpire:210 case Opt_strictexpire:
207 sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;211 sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
208 break;212 break;
213 case Opt_ignore:
214 sbi->flags |= AUTOFS_SBI_IGNORE;
215 break;
209 default:216 default:
210 return 1;217 return 1;
211 }218 }
include/uapi/linux/auto_fs.h+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
23#define AUTOFS_MIN_PROTO_VERSION 323#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 524#define AUTOFS_MAX_PROTO_VERSION 5
25 25
26#define AUTOFS_PROTO_SUBVERSION 426#define AUTOFS_PROTO_SUBVERSION 5
27 27
28/*28/*
29 * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed29 * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed