From 1fbf58cee98e23d69f8bd11d2038910d33b4eee5 Mon Sep 17 00:00:00 2001 From: trasz Date: Sat, 7 Mar 2015 19:36:06 +0000 Subject: MFC r274859: Implement "automount -c". Sponsored by: The FreeBSD Foundation --- sys/fs/autofs/autofs.c | 12 ++++++++++++ sys/fs/autofs/autofs.h | 1 + sys/fs/autofs/autofs_vfsops.c | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'sys/fs/autofs') diff --git a/sys/fs/autofs/autofs.c b/sys/fs/autofs/autofs.c index 0393d13..235d09d 100644 --- a/sys/fs/autofs/autofs.c +++ b/sys/fs/autofs/autofs.c @@ -318,6 +318,18 @@ autofs_cache_callout(void *context) anp->an_cached = false; } +void +autofs_flush(struct autofs_mount *amp) +{ + + /* + * XXX: This will do for now, but ideally we should iterate + * over all the nodes. + */ + amp->am_root->an_cached = false; + AUTOFS_DEBUG("%s flushed", amp->am_mountpoint); +} + /* * The set/restore sigmask functions are used to (temporarily) overwrite * the thread td_sigmask during triggering. diff --git a/sys/fs/autofs/autofs.h b/sys/fs/autofs/autofs.h index 6ea198c..4d16509 100644 --- a/sys/fs/autofs/autofs.h +++ b/sys/fs/autofs/autofs.h @@ -133,6 +133,7 @@ int autofs_trigger(struct autofs_node *anp, const char *component, int componentlen); bool autofs_cached(struct autofs_node *anp, const char *component, int componentlen); +void autofs_flush(struct autofs_mount *amp); bool autofs_ignore_thread(const struct thread *td); int autofs_node_new(struct autofs_node *parent, struct autofs_mount *amp, const char *name, int namelen, struct autofs_node **anpp); diff --git a/sys/fs/autofs/autofs_vfsops.c b/sys/fs/autofs/autofs_vfsops.c index 13a5a89..e84f6b8 100644 --- a/sys/fs/autofs/autofs_vfsops.c +++ b/sys/fs/autofs/autofs_vfsops.c @@ -61,8 +61,10 @@ autofs_mount(struct mount *mp) if (vfs_filteropt(mp->mnt_optnew, autofs_opts)) return (EINVAL); - if (mp->mnt_flag & MNT_UPDATE) + if (mp->mnt_flag & MNT_UPDATE) { + autofs_flush(VFSTOAUTOFS(mp)); return (0); + } if (vfs_getopt(mp->mnt_optnew, "from", (void **)&from, NULL)) return (EINVAL); -- cgit v1.1