diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index 481fa1d..e3c6a45 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -114,27 +114,16 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *dirnm, sc.n_parent = dvp; sc.n_nmlen = nmlen; sc.n_name = name; - if (smp->sm_root != NULL && dvp == NULL) { - SMBERROR("do not allocate root vnode twice!\n"); - return EINVAL; - } + MPASS(!(smp->sm_root != NULL && dvp == NULL)); + MPASS(!(nmlen == 1 && name[0] == '.')); if (nmlen == 2 && bcmp(name, "..", 2) == 0) { - if (dvp == NULL) - return EINVAL; - vp = VTOSMB(VTOSMB(dvp)->n_parent)->n_vnode; - error = vget(vp, LK_EXCLUSIVE, td); - if (error == 0) - *vpp = vp; - return error; - } else if (nmlen == 1 && name[0] == '.') { - SMBERROR("do not call me with dot!\n"); - return EINVAL; + MPASS(dvp != NULL); + sc.n_parent = VTOSMB(dvp)->n_parent; + sc.n_name = VTOSMB(dvp)->n_name; + sc.n_nmlen = VTOSMB(dvp)->n_nmlen; } dnp = dvp ? VTOSMB(dvp) : NULL; - if (dnp == NULL && dvp != NULL) { - vprint("smbfs_node_alloc: dead parent vnode", dvp); - return EINVAL; - } + MPASS(!(dnp == NULL && dvp != NULL)); error = vfs_hash_get(mp, smbfs_hash(name, nmlen), LK_EXCLUSIVE, td, vpp, smbfs_vnode_cmp, &sc); if (error) @@ -201,15 +190,11 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *dirnm, np->n_name = smbfs_name_alloc(name, nmlen); np->n_ino = fap->fa_ino; if (dvp) { - ASSERT_VOP_LOCKED(dvp, "smbfs_node_alloc"); np->n_parent = dvp; np->n_parentino = VTOSMB(dvp)->n_ino; - if (/*vp->v_type == VDIR &&*/ (dvp->v_vflag & VV_ROOT) == 0) { - vref(dvp); - np->n_flag |= NREFPARENT; - } - } else if (vp->v_type == VREG) - SMBERROR("new vnode '%s' born without parent ?\n", np->n_name); + } + else + MPASS(vp->v_type != VREG); error = insmntque(vp, mp); if (error) { free(np, M_SMBNODE); @@ -262,9 +247,7 @@ smbfs_reclaim(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct vnode *dvp; struct smbnode *np = VTOSMB(vp); - struct smbmount *smp = VTOSMBFS(vp); SMBVDEBUG("%s,%d\n", np->n_name, vrefcnt(vp)); @@ -274,8 +257,6 @@ smbfs_reclaim(ap) * Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); - dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ? - np->n_parent : NULL; /* * Remove the vnode from its hash chain. @@ -287,14 +268,6 @@ smbfs_reclaim(ap) free(np->n_rpath, M_SMBNODENAME); free(np, M_SMBNODE); vp->v_data = NULL; - if (dvp != NULL) { - vrele(dvp); - /* - * Indicate that we released something; see comment - * in smbfs_unmount(). - */ - smp->sm_didrele = 1; - } return 0; } diff --git a/sys/fs/smbfs/smbfs_node.h b/sys/fs/smbfs/smbfs_node.h index 9dbc973..cac4456 100644 --- a/sys/fs/smbfs/smbfs_node.h +++ b/sys/fs/smbfs/smbfs_node.h @@ -35,7 +35,7 @@ #define NFLUSHWANT 0x0002 /* they should gone ... */ #define NMODIFIED 0x0004 /* bogus, until async IO implemented */ /*efine NNEW 0x0008*//* smb/vnode has been allocated */ -#define NREFPARENT 0x0010 /* node holds parent from recycling */ +#define NUNUSED 0x0010 /* unused */ #define NFLUSHWIRE 0x1000 /* pending flush request */ #define NOPEN 0x2000 /* file is open */ #define NGONE 0x4000 /* file has been removed/renamed */ diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index 938b7ff..1e6f809 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -269,19 +269,7 @@ smbfs_unmount(struct mount *mp, int mntflags) flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - /* - * Keep trying to flush the vnode list for the mount while - * some are still busy and we are making progress towards - * making them not busy. This is needed because smbfs vnodes - * reference their parent directory but may appear after their - * parent in the list; one pass over the vnode list is not - * sufficient in this case. - */ - do { - smp->sm_didrele = 0; - /* There is 1 extra root vnode reference from smbfs_mount(). */ - error = vflush(mp, 1, flags, td); - } while (error == EBUSY && smp->sm_didrele != 0); + error = vflush(mp, 1, flags, td); if (error) return error; scred = smbfs_malloc_scred();