Index: kern/vfs_subr.c
===================================================================
RCS file: /space2/ncvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.362
diff -u -p -r1.362 vfs_subr.c
--- kern/vfs_subr.c	20 Jun 2002 20:03:41 -0000	1.362
+++ kern/vfs_subr.c	21 Jun 2002 00:32:39 -0000
@@ -532,6 +532,36 @@ bad:
 }
 
 /*
+ * Merge the old mount options with the new ones passed
+ * in the MNT_UPDATE case.
+ */
+void
+vfs_mergeopts(struct vfsoptlist *toopts, struct vfsoptlist *opts)
+{
+	struct vfsopt *opt, *opt2, *new;
+
+	TAILQ_FOREACH(opt, opts, link) {
+		/* Check that this option hasn't been redefined. */
+		opt2 = TAILQ_FIRST(toopts);
+		while (opt2 != NULL) {
+			if (strcmp(opt2->name, opt->name) == 0)
+				goto next;
+			opt2 = TAILQ_NEXT(opt2, link);
+		}
+		/* It hasn't been redefined, so duplicate it. */
+		new = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK);
+		new->name = malloc(strlen(opt->name) + 1, M_MOUNT, M_WAITOK);
+		strcpy(new->name, opt->name);
+		new->value = malloc(opt->len, M_MOUNT, M_WAITOK);
+		bcopy(opt->value, new->value, opt->len);
+		new->len = opt->len;
+		TAILQ_INSERT_TAIL(toopts, new, link);
+next:
+		continue;
+	}
+}
+
+/*
  * Get a mount option by its name.
  *
  * Return 0 if the option was found, ENOENT otherwise.
Index: kern/vfs_syscalls.c
===================================================================
RCS file: /space2/ncvs/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.260
diff -u -p -r1.260 vfs_syscalls.c
--- kern/vfs_syscalls.c	21 Jun 2002 06:18:02 -0000	1.260
+++ kern/vfs_syscalls.c	21 Jun 2002 10:11:01 -0000
@@ -119,7 +119,7 @@ nmount(td, uap)
 	struct uio auio;
 	struct iovec *iov, *needfree;
 	struct iovec aiov[UIO_SMALLIOV];
-	long error, i;
+	int error;
 	u_int iovlen, iovcnt;
 
 	iovcnt = SCARG(uap, iovcnt);
@@ -140,21 +140,9 @@ nmount(td, uap)
 	}
 	auio.uio_iov = iov;
 	auio.uio_iovcnt = iovcnt;
-	auio.uio_rw = UIO_WRITE;
 	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_td = td;
-	auio.uio_offset = 0;
-	auio.uio_resid = 0;
 	if ((error = copyin((caddr_t)uap->iovp, (caddr_t)iov, iovlen)))
 		goto finish;
-	for (i = 0; i < iovcnt; i++) {
-		if (iov->iov_len > INT_MAX - auio.uio_resid) {
-			error = EINVAL;
-			goto finish;
-		}
-		auio.uio_resid += iov->iov_len;
-		iov++;
-	}
 	error = vfs_nmount(td, SCARG(uap, flags), &auio);
 finish:
 	if (needfree != NULL)
@@ -188,8 +176,7 @@ kernel_mount(iovp, iovcnt, flags)
 	int flags;
 {
 	struct uio auio;
-	struct iovec *iov;
-	int error, i;
+	int error;
 
 	/*
 	 * Check that we have an even number of iovec's
@@ -200,19 +187,7 @@ kernel_mount(iovp, iovcnt, flags)
 
 	auio.uio_iov = iovp;
 	auio.uio_iovcnt = iovcnt;
-	auio.uio_rw = UIO_WRITE;
 	auio.uio_segflg = UIO_SYSSPACE;
-	auio.uio_offset = 0;
-	auio.uio_td = NULL;
-	auio.uio_resid = 0;
-	iov = iovp;
-	for (i = 0; i < iovcnt; i++) {
-		if (iov->iov_len > INT_MAX - auio.uio_resid) {
-			return (EINVAL);
-		}
-		auio.uio_resid += iov->iov_len;
-		iov++;
-	}
 
 	error = vfs_nmount(curthread, flags, &auio);
 	return (error);
@@ -255,11 +230,7 @@ kernel_vmount(int flags, ...)
 
 	auio.uio_iov = iovp;
 	auio.uio_iovcnt = iovcnt;
-	auio.uio_rw = UIO_WRITE;
 	auio.uio_segflg = UIO_SYSSPACE;
-	auio.uio_offset = 0;
-	auio.uio_td = NULL;
-	auio.uio_resid = len;
 
 	error = vfs_nmount(curthread, flags, &auio);
 	FREE(iovp, M_MOUNT);
@@ -393,6 +364,8 @@ vfs_nmount(td, fsflags, fsoptions)
 		mp->mnt_flag |= fsflags &
 		    (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
 		VOP_UNLOCK(vp, 0, td);
+		mp->mnt_optnew = optlist;
+		vfs_mergeopts(mp->mnt_optnew, mp->mnt_opt);
 		goto update;
 	}
 	/*
@@ -485,9 +458,9 @@ vfs_nmount(td, fsflags, fsoptions)
 	strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN);
 	mp->mnt_iosize_max = DFLTPHYS;
 	VOP_UNLOCK(vp, 0, td);
+	mp->mnt_optnew = optlist;
 
 update:
-	mp->mnt_optnew = optlist;
 	/*
 	 * Check if the fs implements the new VFS_NMOUNT()
 	 * function, since the new system call was used.
Index: sys/mount.h
===================================================================
RCS file: /space2/ncvs/src/sys/sys/mount.h,v
retrieving revision 1.128
diff -u -p -r1.128 mount.h
--- sys/mount.h	20 Jun 2002 20:03:42 -0000	1.128
+++ sys/mount.h	21 Jun 2002 00:26:08 -0000
@@ -436,6 +436,7 @@ int	dounmount(struct mount *, int, struc
 int	kernel_mount(struct iovec *iovp, unsigned int iovcnt, int flags);
 int	kernel_vmount(int flags, ...);
 int	vfs_buildopts(struct uio *, struct vfsoptlist **);
+void	vfs_mergeopts(struct vfsoptlist *, struct vfsoptlist *);
 void	vfs_freeopts(struct vfsoptlist *);
 int	vfs_getopt(struct vfsoptlist *, const char *, void **, int *);
 int	vfs_copyopt(struct vfsoptlist *, const char *, void *, int);
