Module Name: src
Committed By: snj
Date: Sat Oct 3 23:05:25 UTC 2009
Modified Files:
src/sys/fs/smbfs [netbsd-5]: smbfs_node.c smbfs_vfsops.c
Log Message:
Pull up following revision(s) (requested by njoly in ticket #1041):
sys/fs/smbfs/smbfs_node.c: revision 1.41 via patch
sys/fs/smbfs/smbfs_vfsops.c: revision 1.88 via patch
Fix some panics while trying to umount a smbfs share.
Be sure that no other active vnodes remains, before trying to release
the root one. Likewise, do not destroy the smbmount specific structure
if the umount will fail (busy conditions).
No objection from po...@.
To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/fs/smbfs/smbfs_node.c
cvs rdiff -u -r1.85 -r1.85.4.1 src/sys/fs/smbfs/smbfs_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/smbfs/smbfs_node.c
diff -u src/sys/fs/smbfs/smbfs_node.c:1.39 src/sys/fs/smbfs/smbfs_node.c:1.39.6.1
--- src/sys/fs/smbfs/smbfs_node.c:1.39 Tue Jun 24 17:04:11 2008
+++ src/sys/fs/smbfs/smbfs_node.c Sat Oct 3 23:05:25 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_node.c,v 1.39 2008/06/24 17:04:11 cegger Exp $ */
+/* $NetBSD: smbfs_node.c,v 1.39.6.1 2009/10/03 23:05:25 snj Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.39 2008/06/24 17:04:11 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.39.6.1 2009/10/03 23:05:25 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -244,8 +244,6 @@
SMBVDEBUG("%.*s,%d\n", (int) np->n_nmlen, np->n_name, vp->v_usecount);
- KASSERT((np->n_flag & NOPEN) == 0);
-
mutex_enter(&smp->sm_hashlock);
dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ?
Index: src/sys/fs/smbfs/smbfs_vfsops.c
diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.85 src/sys/fs/smbfs/smbfs_vfsops.c:1.85.4.1
--- src/sys/fs/smbfs/smbfs_vfsops.c:1.85 Sun Sep 7 13:13:04 2008
+++ src/sys/fs/smbfs/smbfs_vfsops.c Sat Oct 3 23:05:25 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_vfsops.c,v 1.85 2008/09/07 13:13:04 tron Exp $ */
+/* $NetBSD: smbfs_vfsops.c,v 1.85.4.1 2009/10/03 23:05:25 snj Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.85 2008/09/07 13:13:04 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.85.4.1 2009/10/03 23:05:25 snj Exp $");
#ifdef _KERNEL_OPT
#include "opt_quota.h"
@@ -236,6 +236,7 @@
struct lwp *l = curlwp;
struct smbmount *smp = VFSTOSMBFS(mp);
struct smb_cred scred;
+ struct vnode *smbfs_rootvp = SMBTOV(smp->sm_root);
int error, flags;
SMBVDEBUG("smbfs_unmount: flags=%04x\n", mntflags);
@@ -244,11 +245,8 @@
flags |= FORCECLOSE;
#ifdef QUOTA
#endif
- /* Drop the extra reference to root vnode. */
- if (smp->sm_root) {
- vrele(SMBTOV(smp->sm_root));
- smp->sm_root = NULL;
- }
+ if (smbfs_rootvp->v_usecount > 1 && (mntflags & MNT_FORCE) == 0)
+ return EBUSY;
/* Flush all vnodes.
* Keep trying to flush the vnode list for the mount while
@@ -259,8 +257,12 @@
* sufficient in this case. */
do {
smp->sm_didrele = 0;
- error = vflush(mp, NULLVP, flags);
+ error = vflush(mp, smbfs_rootvp, flags);
} while (error == EBUSY && smp->sm_didrele != 0);
+ if (error)
+ return error;
+
+ vgone(smbfs_rootvp);
smb_makescred(&scred, l, l->l_cred);
smb_share_lock(smp->sm_share);
@@ -270,7 +272,7 @@
hashdone(smp->sm_hash, HASH_LIST, smp->sm_hashlen);
mutex_destroy(&smp->sm_hashlock);
FREE(smp, M_SMBFSDATA);
- return error;
+ return 0;
}
/*