Module Name: src
Committed By: christos
Date: Tue Jul 7 14:09:05 UTC 2009
Modified Files:
src/sys/nfs: nfs_export.c nfs_syscalls.c nfs_var.h
Log Message:
The compatibility call to re-export from sys_mount() calls
mountd_set_exports_list, with the mnt_updating mutex held. Account for that
to avoid a locking against myself panic.
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/nfs/nfs_export.c
cvs rdiff -u -r1.148 -r1.149 src/sys/nfs/nfs_syscalls.c
cvs rdiff -u -r1.87 -r1.88 src/sys/nfs/nfs_var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/nfs/nfs_export.c
diff -u src/sys/nfs/nfs_export.c:1.47 src/sys/nfs/nfs_export.c:1.48
--- src/sys/nfs/nfs_export.c:1.47 Sat May 23 14:19:19 2009
+++ src/sys/nfs/nfs_export.c Tue Jul 7 10:09:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_export.c,v 1.47 2009/05/23 18:19:19 ad Exp $ */
+/* $NetBSD: nfs_export.c,v 1.48 2009/07/07 14:09:05 christos Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.47 2009/05/23 18:19:19 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.48 2009/07/07 14:09:05 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -236,7 +236,8 @@
* command).
*/
int
-mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l)
+mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l,
+ struct mount *nmp)
{
int error;
#ifdef notyet
@@ -260,6 +261,7 @@
return error;
vp = nd.ni_vp;
mp = vp->v_mount;
+ KASSERT(nmp == NULL || nmp == mp);
/*
* Make sure the file system can do vptofh. If the file system
@@ -278,7 +280,8 @@
vput(vp);
if (error != 0)
return error;
- mutex_enter(&mp->mnt_updating); /* mnt_flag */
+ if (nmp == NULL)
+ mutex_enter(&mp->mnt_updating); /* mnt_flag */
netexport_wrlock();
ne = netexport_lookup(mp);
if (ne == NULL) {
@@ -311,15 +314,16 @@
else if (mel->mel_nexports == 1)
error = export(ne, &mel->mel_exports[0]);
else {
- printf("mountd_set_exports_list: Cannot set more than one "
- "entry at once (unimplemented)\n");
+ printf("%s: Cannot set more than one "
+ "entry at once (unimplemented)\n", __func__);
error = EOPNOTSUPP;
}
#endif
out:
netexport_wrunlock();
- mutex_exit(&mp->mnt_updating); /* mnt_flag */
+ if (nmp == NULL)
+ mutex_exit(&mp->mnt_updating); /* mnt_flag */
vfs_unbusy(mp, false, NULL);
return error;
}
@@ -441,7 +445,7 @@
mel.mel_exports = (void *)&args->eargs;
}
- return mountd_set_exports_list(&mel, curlwp);
+ return mountd_set_exports_list(&mel, curlwp, mp);
}
/*
Index: src/sys/nfs/nfs_syscalls.c
diff -u src/sys/nfs/nfs_syscalls.c:1.148 src/sys/nfs/nfs_syscalls.c:1.149
--- src/sys/nfs/nfs_syscalls.c:1.148 Sat May 23 10:44:56 2009
+++ src/sys/nfs/nfs_syscalls.c Tue Jul 7 10:09:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_syscalls.c,v 1.148 2009/05/23 14:44:56 ad Exp $ */
+/* $NetBSD: nfs_syscalls.c,v 1.149 2009/07/07 14:09:05 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.148 2009/05/23 14:44:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.149 2009/07/07 14:09:05 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -192,7 +192,7 @@
}
mel.mel_exports = args;
- error = mountd_set_exports_list(&mel, l);
+ error = mountd_set_exports_list(&mel, l, NULL);
free(args, M_TEMP);
} else {
Index: src/sys/nfs/nfs_var.h
diff -u src/sys/nfs/nfs_var.h:1.87 src/sys/nfs/nfs_var.h:1.88
--- src/sys/nfs/nfs_var.h:1.87 Sat May 23 11:31:21 2009
+++ src/sys/nfs/nfs_var.h Tue Jul 7 10:09:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_var.h,v 1.87 2009/05/23 15:31:21 ad Exp $ */
+/* $NetBSD: nfs_var.h,v 1.88 2009/07/07 14:09:05 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -300,7 +300,8 @@
/* nfs_export.c */
extern struct nfs_public nfs_pub;
-int mountd_set_exports_list(const struct mountd_exports_list *, struct lwp *);
+int mountd_set_exports_list(const struct mountd_exports_list *, struct lwp *,
+ struct mount *);
int netexport_check(const fsid_t *, struct mbuf *, struct mount **, int *,
kauth_cred_t *);
void netexport_rdlock(void);