From 1aad294b4e11f3933233df6d3a182a93f37db0f1 Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Sat, 12 Jul 2008 20:12:40 +0000 Subject: [PATCH] In nmount(), if we see "update" in the mount options, set MNT_UPDATE in fsflags, and delete the "update" option from the global mount options. MNT_UPDATE is a command, and not a property of a mount that should persist after the command is executed. We need to do similar things for MNT_FORCE and MNT_RELOAD. All mount flags are prefixed by MNT_..... it would be nice if flags which were commands were named differently from flags which are persistent properties of a mount. This was not such a big deal in the pre-nmount() days, but with nmount() it is more important. Requested by: yar MFC after: 2 weeks --- sys/kern/vfs_mount.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index ade918ab9ce9..744f4e9a1694 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -133,7 +133,6 @@ static const char *global_opts[] = { "rw", "nosuid", "noexec", - "update", NULL }; @@ -586,7 +585,7 @@ static int vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) { struct vfsoptlist *optlist; - struct vfsopt *opt, *noro_opt; + struct vfsopt *opt, *noro_opt, *tmp_opt; char *fstype, *fspath, *errmsg; int error, fstypelen, fspathlen, errmsg_len, errmsg_pos; int has_rw, has_noro; @@ -632,9 +631,11 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) * logic based on MNT_UPDATE. This is very important * when we want to update the root filesystem. */ - TAILQ_FOREACH(opt, optlist, link) { - if (strcmp(opt->name, "update") == 0) + TAILQ_FOREACH_SAFE(opt, optlist, link, tmp_opt) { + if (strcmp(opt->name, "update") == 0) { fsflags |= MNT_UPDATE; + vfs_freeopt(optlist, opt); + } else if (strcmp(opt->name, "async") == 0) fsflags |= MNT_ASYNC; else if (strcmp(opt->name, "force") == 0)