Skip to content

Commit

Permalink
autofs: add ignore mount option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
raven-au authored and torvalds committed Mar 8, 2019
1 parent 8496ecd commit 60d6d04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions fs/autofs/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct autofs_wait_queue {

#define AUTOFS_SBI_CATATONIC 0x0001
#define AUTOFS_SBI_STRICTEXPIRE 0x0002
#define AUTOFS_SBI_IGNORE 0x0004

struct autofs_sb_info {
u32 magic;
Expand Down
9 changes: 8 additions & 1 deletion fs/autofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ static int autofs_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",indirect");
if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
seq_printf(m, ",strictexpire");
if (sbi->flags & AUTOFS_SBI_IGNORE)
seq_printf(m, ",ignore");
#ifdef CONFIG_CHECKPOINT_RESTORE
if (sbi->pipe)
seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
Expand All @@ -111,7 +113,8 @@ static const struct super_operations autofs_sops = {
};

enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire};
Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire,
Opt_ignore};

static const match_table_t tokens = {
{Opt_fd, "fd=%u"},
Expand All @@ -124,6 +127,7 @@ static const match_table_t tokens = {
{Opt_direct, "direct"},
{Opt_offset, "offset"},
{Opt_strictexpire, "strictexpire"},
{Opt_ignore, "ignore"},
{Opt_err, NULL}
};

Expand Down Expand Up @@ -206,6 +210,9 @@ static int parse_options(char *options,
case Opt_strictexpire:
sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
break;
case Opt_ignore:
sbi->flags |= AUTOFS_SBI_IGNORE;
break;
default:
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/linux/auto_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define AUTOFS_MIN_PROTO_VERSION 3
#define AUTOFS_MAX_PROTO_VERSION 5

#define AUTOFS_PROTO_SUBVERSION 4
#define AUTOFS_PROTO_SUBVERSION 5

/*
* The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
Expand Down

0 comments on commit 60d6d04

Please sign in to comment.