summaryrefslogtreecommitdiffstats
path: root/sys/fs/smbfs/smbfs_node.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-06-17 12:58:02 +0000
committertjr <tjr@FreeBSD.org>2003-06-17 12:58:02 +0000
commit6d534d8e046165eceeeee1a288da8f557d4aa386 (patch)
tree6b7cbb58c0fa43be160cb35cbea22eab90824a90 /sys/fs/smbfs/smbfs_node.c
parentec215fe3e905337cba439b9419c1448ebbc5741f (diff)
downloadFreeBSD-src-6d534d8e046165eceeeee1a288da8f557d4aa386.zip
FreeBSD-src-6d534d8e046165eceeeee1a288da8f557d4aa386.tar.gz
Send the close request to the SMB server in smbfs_inactive(), instead of
smbfs_close(). This fixes paging to and from mmap()'d regions of smbfs files after the descriptor has been closed, and makes thttpd, GNU ld, and perhaps more things work that depend on being able to do this. PR: 48291
Diffstat (limited to 'sys/fs/smbfs/smbfs_node.c')
-rw-r--r--sys/fs/smbfs/smbfs_node.c23
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);
}
OpenPOWER on IntegriCloud