diff options
Diffstat (limited to 'sys/fs/smbfs/smbfs_node.c')
-rw-r--r-- | sys/fs/smbfs/smbfs_node.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index 093e7ca4..811721f 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -300,6 +300,8 @@ smbfs_reclaim(ap) SMBVDEBUG("%s,%d\n", np->n_name, vrefcnt(vp)); + KASSERT((np->n_flag & NOPEN) == 0, ("file not closed before reclaim")); + smbfs_hash_lock(smp, td); dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ? @@ -340,16 +342,25 @@ smbfs_inactive(ap) struct vnode *vp = ap->a_vp; struct smbnode *np = VTOSMB(vp); struct smb_cred scred; - int error; + struct vattr va; SMBVDEBUG("%s: %d\n", VTOSMB(vp)->n_name, vrefcnt(vp)); - if (np->n_opencount) { - error = smbfs_vinvalbuf(vp, V_SAVE, cred, td, 1); + if ((np->n_flag & NOPEN) != 0) { smb_makescred(&scred, td, cred); - error = smbfs_smb_close(np->n_mount->sm_share, np->n_fid, - &np->n_mtime, &scred); - np->n_opencount = 0; + smbfs_vinvalbuf(vp, V_SAVE, cred, td, 1); + if (vp->v_type == VREG) { + VOP_GETATTR(vp, &va, cred, td); + smbfs_smb_close(np->n_mount->sm_share, np->n_fid, + &np->n_mtime, &scred); + } else if (vp->v_type == VDIR) { + if (np->n_dirseq != NULL) { + smbfs_findclose(np->n_dirseq, &scred); + np->n_dirseq = NULL; + } + } + np->n_flag &= ~NOPEN; } + smbfs_attr_cacheremove(vp); VOP_UNLOCK(vp, 0, td); return (0); } |