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.
This commit is contained in:
christos 2009-07-07 14:09:05 +00:00
parent 2a64051b50
commit e234b387dc
3 changed files with 18 additions and 13 deletions

View File

@ -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 @@ netexport_fini(void)
* 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 @@ mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l)
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,6 +280,7 @@ mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l)
vput(vp);
if (error != 0)
return error;
if (nmp == NULL)
mutex_enter(&mp->mnt_updating); /* mnt_flag */
netexport_wrlock();
ne = netexport_lookup(mp);
@ -311,14 +314,15 @@ mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l)
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();
if (nmp == NULL)
mutex_exit(&mp->mnt_updating); /* mnt_flag */
vfs_unbusy(mp, false, NULL);
return error;
@ -441,7 +445,7 @@ nfs_export_update_30(struct mount *mp, const char *path, void *data)
mel.mel_exports = (void *)&args->eargs;
}
return mountd_set_exports_list(&mel, curlwp);
return mountd_set_exports_list(&mel, curlwp, mp);
}
/*

View File

@ -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 @@ sys_nfssvc(struct lwp *l, const struct sys_nfssvc_args *uap, register_t *retval)
}
mel.mel_exports = args;
error = mountd_set_exports_list(&mel, l);
error = mountd_set_exports_list(&mel, l, NULL);
free(args, M_TEMP);
} else {

View File

@ -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 @@ int nfs_savenickauth(struct nfsmount *, kauth_cred_t, int, NFSKERBKEY_T,
/* 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);