33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/kdb.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/malloc.h> 40#include <sys/mount.h> 41#include <sys/proc.h> 42#include <sys/queue.h> 43#include <sys/sysctl.h> 44#include <sys/time.h> 45#include <sys/vnode.h> 46 47#include <netsmb/smb.h> 48#include <netsmb/smb_conn.h> 49#include <netsmb/smb_subr.h> 50 51#include <vm/vm.h> 52#include <vm/vm_extern.h> 53/*#include <vm/vm_page.h> 54#include <vm/vm_object.h>*/ 55 56#include <fs/smbfs/smbfs.h> 57#include <fs/smbfs/smbfs_node.h> 58#include <fs/smbfs/smbfs_subr.h> 59 60#define SMBFS_NOHASH(smp, hval) (&(smp)->sm_hash[(hval) & (smp)->sm_hashlen]) 61#define smbfs_hash_lock(smp, td) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL, td) 62#define smbfs_hash_unlock(smp, td) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, td) 63 64 65extern struct vop_vector smbfs_vnodeops; /* XXX -> .h file */ 66 67MALLOC_DEFINE(M_SMBNODE, "SMBFS node", "SMBFS vnode private part"); 68static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name"); 69 70int smbfs_hashprint(struct mount *mp); 71 72#if 0 73#ifdef SYSCTL_DECL 74SYSCTL_DECL(_vfs_smbfs); 75#endif 76SYSCTL_PROC(_vfs_smbfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, 77 NULL, 0, smbfs_hashprint, "S,vnlist", "vnode hash"); 78#endif 79 80#define FNV_32_PRIME ((u_int32_t) 0x01000193UL) 81#define FNV1_32_INIT ((u_int32_t) 33554467UL) 82 83u_int32_t 84smbfs_hash(const u_char *name, int nmlen) 85{ 86 u_int32_t v; 87 88 for (v = FNV1_32_INIT; nmlen; name++, nmlen--) { 89 v *= FNV_32_PRIME; 90 v ^= (u_int32_t)*name; 91 } 92 return v; 93} 94 95int 96smbfs_hashprint(struct mount *mp) 97{ 98 struct smbmount *smp = VFSTOSMBFS(mp); 99 struct smbnode_hashhead *nhpp; 100 struct smbnode *np; 101 int i; 102 103 for(i = 0; i <= smp->sm_hashlen; i++) { 104 nhpp = &smp->sm_hash[i]; 105 LIST_FOREACH(np, nhpp, n_hash) 106 vprint(NULL, SMBTOV(np)); 107 } 108 return 0; 109} 110 111static char * 112smbfs_name_alloc(const u_char *name, int nmlen) 113{ 114 u_char *cp; 115 116 nmlen++; 117#ifdef SMBFS_NAME_DEBUG 118 cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); 119 *(int*)cp = nmlen; 120 cp += sizeof(int); 121 cp[0] = 0xfc; 122 cp++; 123 bcopy(name, cp, nmlen - 1); 124 cp[nmlen] = 0xfe; 125#else 126 cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK); 127 bcopy(name, cp, nmlen - 1); 128#endif 129 cp[nmlen - 1] = 0; 130 return cp; 131} 132 133static void 134smbfs_name_free(u_char *name) 135{ 136#ifdef SMBFS_NAME_DEBUG 137 int nmlen, slen; 138 u_char *cp; 139 140 cp = name; 141 cp--; 142 if (*cp != 0xfc) { 143 printf("First byte of name entry '%s' corrupted\n", name); 144 kdb_enter("ditto"); 145 } 146 cp -= sizeof(int); 147 nmlen = *(int*)cp; 148 slen = strlen(name) + 1; 149 if (nmlen != slen) { 150 printf("Name length mismatch: was %d, now %d name '%s'\n", 151 nmlen, slen, name); 152 kdb_enter("ditto"); 153 } 154 if (name[nmlen] != 0xfe) { 155 printf("Last byte of name entry '%s' corrupted\n", name); 156 kdb_enter("ditto"); 157 } 158 free(cp, M_SMBNODENAME); 159#else 160 free(name, M_SMBNODENAME); 161#endif 162} 163 164static int 165smbfs_node_alloc(struct mount *mp, struct vnode *dvp, 166 const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) 167{ 168 struct vattr vattr; 169 struct thread *td = curthread; /* XXX */ 170 struct smbmount *smp = VFSTOSMBFS(mp); 171 struct smbnode_hashhead *nhpp; 172 struct smbnode *np, *np2, *dnp; 173 struct vnode *vp; 174 u_long hashval; 175 int error; 176 177 *vpp = NULL; 178 if (smp->sm_root != NULL && dvp == NULL) { 179 SMBERROR("do not allocate root vnode twice!\n"); 180 return EINVAL; 181 } 182 if (nmlen == 2 && bcmp(name, "..", 2) == 0) { 183 if (dvp == NULL) 184 return EINVAL; 185 vp = VTOSMB(VTOSMB(dvp)->n_parent)->n_vnode; 186 error = vget(vp, LK_EXCLUSIVE, td); 187 if (error == 0) 188 *vpp = vp; 189 return error; 190 } else if (nmlen == 1 && name[0] == '.') { 191 SMBERROR("do not call me with dot!\n"); 192 return EINVAL; 193 } 194 dnp = dvp ? VTOSMB(dvp) : NULL; 195 if (dnp == NULL && dvp != NULL) { 196 vprint("smbfs_node_alloc: dead parent vnode", dvp); 197 return EINVAL; 198 } 199 hashval = smbfs_hash(name, nmlen); 200retry: 201 smbfs_hash_lock(smp, td); 202loop: 203 nhpp = SMBFS_NOHASH(smp, hashval); 204 LIST_FOREACH(np, nhpp, n_hash) { 205 vp = SMBTOV(np); 206 if (np->n_parent != dvp || 207 np->n_nmlen != nmlen || bcmp(name, np->n_name, nmlen) != 0) 208 continue; 209 VI_LOCK(vp); 210 smbfs_hash_unlock(smp, td); 211 if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0) 212 goto retry; 213 /* Force cached attributes to be refreshed if stale. */ 214 (void)VOP_GETATTR(vp, &vattr, td->td_ucred, td); 215 /* 216 * If the file type on the server is inconsistent with 217 * what it was when we created the vnode, kill the 218 * bogus vnode now and fall through to the code below 219 * to create a new one with the right type. 220 */ 221 if ((vp->v_type == VDIR && (np->n_dosattr & SMB_FA_DIR) == 0) || 222 (vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) { 223 vput(vp); 224 vgone(vp); 225 break; 226 } 227 *vpp = vp; 228 return 0; 229 } 230 smbfs_hash_unlock(smp, td); 231 /* 232 * If we don't have node attributes, then it is an explicit lookup 233 * for an existing vnode. 234 */ 235 if (fap == NULL) 236 return ENOENT; 237 238 MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); 239 error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); 240 if (error) { 241 FREE(np, M_SMBNODE); 242 return error; 243 } 244 vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; 245 bzero(np, sizeof(*np)); 246 vp->v_data = np; 247 np->n_vnode = vp; 248 np->n_mount = VFSTOSMBFS(mp); 249 np->n_nmlen = nmlen; 250 np->n_name = smbfs_name_alloc(name, nmlen); 251 np->n_ino = fap->fa_ino; 252 253 if (dvp) { 254 ASSERT_VOP_LOCKED(dvp, "smbfs_node_alloc"); 255 np->n_parent = dvp; 256 if (/*vp->v_type == VDIR &&*/ (dvp->v_vflag & VV_ROOT) == 0) { 257 vref(dvp); 258 np->n_flag |= NREFPARENT; 259 } 260 } else if (vp->v_type == VREG) 261 SMBERROR("new vnode '%s' born without parent ?\n", np->n_name); 262 263 vp->v_vnlock->lk_flags |= LK_CANRECURSE; 264 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); 265 266 smbfs_hash_lock(smp, td); 267 LIST_FOREACH(np2, nhpp, n_hash) { 268 if (np2->n_parent != dvp || 269 np2->n_nmlen != nmlen || bcmp(name, np2->n_name, nmlen) != 0) 270 continue; 271 vput(vp); 272/* smb_name_free(np->n_name); 273 FREE(np, M_SMBNODE);*/ 274 goto loop; 275 } 276 LIST_INSERT_HEAD(nhpp, np, n_hash); 277 smbfs_hash_unlock(smp, td); 278 *vpp = vp; 279 return 0; 280} 281 282int 283smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, 284 struct smbfattr *fap, struct vnode **vpp) 285{ 286 struct smbnode *np; 287 struct vnode *vp; 288 int error; 289 290 *vpp = NULL; 291 error = smbfs_node_alloc(mp, dvp, name, nmlen, fap, &vp); 292 if (error) 293 return error; 294 np = VTOSMB(vp); 295 if (fap) 296 smbfs_attr_cacheenter(vp, fap); 297 *vpp = vp; 298 return 0; 299} 300 301/* 302 * Free smbnode, and give vnode back to system 303 */ 304int 305smbfs_reclaim(ap) 306 struct vop_reclaim_args /* { 307 struct vnode *a_vp; 308 struct thread *a_p; 309 } */ *ap; 310{ 311 struct vnode *vp = ap->a_vp; 312 struct thread *td = ap->a_td; 313 struct vnode *dvp; 314 struct smbnode *np = VTOSMB(vp); 315 struct smbmount *smp = VTOSMBFS(vp); 316 317 SMBVDEBUG("%s,%d\n", np->n_name, vrefcnt(vp)); 318 319 KASSERT((np->n_flag & NOPEN) == 0, ("file not closed before reclaim")); 320 321 smbfs_hash_lock(smp, td); 322 323 dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ? 324 np->n_parent : NULL; 325 326 if (np->n_hash.le_prev) 327 LIST_REMOVE(np, n_hash); 328 if (smp->sm_root == np) { 329 SMBVDEBUG("root vnode\n"); 330 smp->sm_root = NULL; 331 } 332 vp->v_data = NULL; 333 smbfs_hash_unlock(smp, td); 334 if (np->n_name) 335 smbfs_name_free(np->n_name); 336 FREE(np, M_SMBNODE); 337 if (dvp != NULL) { 338 vrele(dvp); 339 /* 340 * Indicate that we released something; see comment 341 * in smbfs_unmount(). 342 */ 343 smp->sm_didrele = 1; 344 } 345 return 0; 346} 347 348int 349smbfs_inactive(ap) 350 struct vop_inactive_args /* { 351 struct vnode *a_vp; 352 struct thread *a_td; 353 } */ *ap; 354{ 355 struct thread *td = ap->a_td; 356 struct ucred *cred = td->td_ucred; 357 struct vnode *vp = ap->a_vp; 358 struct smbnode *np = VTOSMB(vp); 359 struct smb_cred scred; 360 struct vattr va; 361 362 SMBVDEBUG("%s: %d\n", VTOSMB(vp)->n_name, vrefcnt(vp)); 363 if ((np->n_flag & NOPEN) != 0) { 364 smb_makescred(&scred, td, cred); 365 smbfs_vinvalbuf(vp, td); 366 if (vp->v_type == VREG) { 367 VOP_GETATTR(vp, &va, cred, td); 368 smbfs_smb_close(np->n_mount->sm_share, np->n_fid, 369 &np->n_mtime, &scred); 370 } else if (vp->v_type == VDIR) { 371 if (np->n_dirseq != NULL) { 372 smbfs_findclose(np->n_dirseq, &scred); 373 np->n_dirseq = NULL; 374 } 375 } 376 np->n_flag &= ~NOPEN; 377 smbfs_attr_cacheremove(vp); 378 } 379 VOP_UNLOCK(vp, 0, td); 380 if (np->n_flag & NGONE)
| 33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/kdb.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/malloc.h> 40#include <sys/mount.h> 41#include <sys/proc.h> 42#include <sys/queue.h> 43#include <sys/sysctl.h> 44#include <sys/time.h> 45#include <sys/vnode.h> 46 47#include <netsmb/smb.h> 48#include <netsmb/smb_conn.h> 49#include <netsmb/smb_subr.h> 50 51#include <vm/vm.h> 52#include <vm/vm_extern.h> 53/*#include <vm/vm_page.h> 54#include <vm/vm_object.h>*/ 55 56#include <fs/smbfs/smbfs.h> 57#include <fs/smbfs/smbfs_node.h> 58#include <fs/smbfs/smbfs_subr.h> 59 60#define SMBFS_NOHASH(smp, hval) (&(smp)->sm_hash[(hval) & (smp)->sm_hashlen]) 61#define smbfs_hash_lock(smp, td) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL, td) 62#define smbfs_hash_unlock(smp, td) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, td) 63 64 65extern struct vop_vector smbfs_vnodeops; /* XXX -> .h file */ 66 67MALLOC_DEFINE(M_SMBNODE, "SMBFS node", "SMBFS vnode private part"); 68static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name"); 69 70int smbfs_hashprint(struct mount *mp); 71 72#if 0 73#ifdef SYSCTL_DECL 74SYSCTL_DECL(_vfs_smbfs); 75#endif 76SYSCTL_PROC(_vfs_smbfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, 77 NULL, 0, smbfs_hashprint, "S,vnlist", "vnode hash"); 78#endif 79 80#define FNV_32_PRIME ((u_int32_t) 0x01000193UL) 81#define FNV1_32_INIT ((u_int32_t) 33554467UL) 82 83u_int32_t 84smbfs_hash(const u_char *name, int nmlen) 85{ 86 u_int32_t v; 87 88 for (v = FNV1_32_INIT; nmlen; name++, nmlen--) { 89 v *= FNV_32_PRIME; 90 v ^= (u_int32_t)*name; 91 } 92 return v; 93} 94 95int 96smbfs_hashprint(struct mount *mp) 97{ 98 struct smbmount *smp = VFSTOSMBFS(mp); 99 struct smbnode_hashhead *nhpp; 100 struct smbnode *np; 101 int i; 102 103 for(i = 0; i <= smp->sm_hashlen; i++) { 104 nhpp = &smp->sm_hash[i]; 105 LIST_FOREACH(np, nhpp, n_hash) 106 vprint(NULL, SMBTOV(np)); 107 } 108 return 0; 109} 110 111static char * 112smbfs_name_alloc(const u_char *name, int nmlen) 113{ 114 u_char *cp; 115 116 nmlen++; 117#ifdef SMBFS_NAME_DEBUG 118 cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); 119 *(int*)cp = nmlen; 120 cp += sizeof(int); 121 cp[0] = 0xfc; 122 cp++; 123 bcopy(name, cp, nmlen - 1); 124 cp[nmlen] = 0xfe; 125#else 126 cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK); 127 bcopy(name, cp, nmlen - 1); 128#endif 129 cp[nmlen - 1] = 0; 130 return cp; 131} 132 133static void 134smbfs_name_free(u_char *name) 135{ 136#ifdef SMBFS_NAME_DEBUG 137 int nmlen, slen; 138 u_char *cp; 139 140 cp = name; 141 cp--; 142 if (*cp != 0xfc) { 143 printf("First byte of name entry '%s' corrupted\n", name); 144 kdb_enter("ditto"); 145 } 146 cp -= sizeof(int); 147 nmlen = *(int*)cp; 148 slen = strlen(name) + 1; 149 if (nmlen != slen) { 150 printf("Name length mismatch: was %d, now %d name '%s'\n", 151 nmlen, slen, name); 152 kdb_enter("ditto"); 153 } 154 if (name[nmlen] != 0xfe) { 155 printf("Last byte of name entry '%s' corrupted\n", name); 156 kdb_enter("ditto"); 157 } 158 free(cp, M_SMBNODENAME); 159#else 160 free(name, M_SMBNODENAME); 161#endif 162} 163 164static int 165smbfs_node_alloc(struct mount *mp, struct vnode *dvp, 166 const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) 167{ 168 struct vattr vattr; 169 struct thread *td = curthread; /* XXX */ 170 struct smbmount *smp = VFSTOSMBFS(mp); 171 struct smbnode_hashhead *nhpp; 172 struct smbnode *np, *np2, *dnp; 173 struct vnode *vp; 174 u_long hashval; 175 int error; 176 177 *vpp = NULL; 178 if (smp->sm_root != NULL && dvp == NULL) { 179 SMBERROR("do not allocate root vnode twice!\n"); 180 return EINVAL; 181 } 182 if (nmlen == 2 && bcmp(name, "..", 2) == 0) { 183 if (dvp == NULL) 184 return EINVAL; 185 vp = VTOSMB(VTOSMB(dvp)->n_parent)->n_vnode; 186 error = vget(vp, LK_EXCLUSIVE, td); 187 if (error == 0) 188 *vpp = vp; 189 return error; 190 } else if (nmlen == 1 && name[0] == '.') { 191 SMBERROR("do not call me with dot!\n"); 192 return EINVAL; 193 } 194 dnp = dvp ? VTOSMB(dvp) : NULL; 195 if (dnp == NULL && dvp != NULL) { 196 vprint("smbfs_node_alloc: dead parent vnode", dvp); 197 return EINVAL; 198 } 199 hashval = smbfs_hash(name, nmlen); 200retry: 201 smbfs_hash_lock(smp, td); 202loop: 203 nhpp = SMBFS_NOHASH(smp, hashval); 204 LIST_FOREACH(np, nhpp, n_hash) { 205 vp = SMBTOV(np); 206 if (np->n_parent != dvp || 207 np->n_nmlen != nmlen || bcmp(name, np->n_name, nmlen) != 0) 208 continue; 209 VI_LOCK(vp); 210 smbfs_hash_unlock(smp, td); 211 if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0) 212 goto retry; 213 /* Force cached attributes to be refreshed if stale. */ 214 (void)VOP_GETATTR(vp, &vattr, td->td_ucred, td); 215 /* 216 * If the file type on the server is inconsistent with 217 * what it was when we created the vnode, kill the 218 * bogus vnode now and fall through to the code below 219 * to create a new one with the right type. 220 */ 221 if ((vp->v_type == VDIR && (np->n_dosattr & SMB_FA_DIR) == 0) || 222 (vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) { 223 vput(vp); 224 vgone(vp); 225 break; 226 } 227 *vpp = vp; 228 return 0; 229 } 230 smbfs_hash_unlock(smp, td); 231 /* 232 * If we don't have node attributes, then it is an explicit lookup 233 * for an existing vnode. 234 */ 235 if (fap == NULL) 236 return ENOENT; 237 238 MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); 239 error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); 240 if (error) { 241 FREE(np, M_SMBNODE); 242 return error; 243 } 244 vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; 245 bzero(np, sizeof(*np)); 246 vp->v_data = np; 247 np->n_vnode = vp; 248 np->n_mount = VFSTOSMBFS(mp); 249 np->n_nmlen = nmlen; 250 np->n_name = smbfs_name_alloc(name, nmlen); 251 np->n_ino = fap->fa_ino; 252 253 if (dvp) { 254 ASSERT_VOP_LOCKED(dvp, "smbfs_node_alloc"); 255 np->n_parent = dvp; 256 if (/*vp->v_type == VDIR &&*/ (dvp->v_vflag & VV_ROOT) == 0) { 257 vref(dvp); 258 np->n_flag |= NREFPARENT; 259 } 260 } else if (vp->v_type == VREG) 261 SMBERROR("new vnode '%s' born without parent ?\n", np->n_name); 262 263 vp->v_vnlock->lk_flags |= LK_CANRECURSE; 264 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); 265 266 smbfs_hash_lock(smp, td); 267 LIST_FOREACH(np2, nhpp, n_hash) { 268 if (np2->n_parent != dvp || 269 np2->n_nmlen != nmlen || bcmp(name, np2->n_name, nmlen) != 0) 270 continue; 271 vput(vp); 272/* smb_name_free(np->n_name); 273 FREE(np, M_SMBNODE);*/ 274 goto loop; 275 } 276 LIST_INSERT_HEAD(nhpp, np, n_hash); 277 smbfs_hash_unlock(smp, td); 278 *vpp = vp; 279 return 0; 280} 281 282int 283smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, 284 struct smbfattr *fap, struct vnode **vpp) 285{ 286 struct smbnode *np; 287 struct vnode *vp; 288 int error; 289 290 *vpp = NULL; 291 error = smbfs_node_alloc(mp, dvp, name, nmlen, fap, &vp); 292 if (error) 293 return error; 294 np = VTOSMB(vp); 295 if (fap) 296 smbfs_attr_cacheenter(vp, fap); 297 *vpp = vp; 298 return 0; 299} 300 301/* 302 * Free smbnode, and give vnode back to system 303 */ 304int 305smbfs_reclaim(ap) 306 struct vop_reclaim_args /* { 307 struct vnode *a_vp; 308 struct thread *a_p; 309 } */ *ap; 310{ 311 struct vnode *vp = ap->a_vp; 312 struct thread *td = ap->a_td; 313 struct vnode *dvp; 314 struct smbnode *np = VTOSMB(vp); 315 struct smbmount *smp = VTOSMBFS(vp); 316 317 SMBVDEBUG("%s,%d\n", np->n_name, vrefcnt(vp)); 318 319 KASSERT((np->n_flag & NOPEN) == 0, ("file not closed before reclaim")); 320 321 smbfs_hash_lock(smp, td); 322 323 dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ? 324 np->n_parent : NULL; 325 326 if (np->n_hash.le_prev) 327 LIST_REMOVE(np, n_hash); 328 if (smp->sm_root == np) { 329 SMBVDEBUG("root vnode\n"); 330 smp->sm_root = NULL; 331 } 332 vp->v_data = NULL; 333 smbfs_hash_unlock(smp, td); 334 if (np->n_name) 335 smbfs_name_free(np->n_name); 336 FREE(np, M_SMBNODE); 337 if (dvp != NULL) { 338 vrele(dvp); 339 /* 340 * Indicate that we released something; see comment 341 * in smbfs_unmount(). 342 */ 343 smp->sm_didrele = 1; 344 } 345 return 0; 346} 347 348int 349smbfs_inactive(ap) 350 struct vop_inactive_args /* { 351 struct vnode *a_vp; 352 struct thread *a_td; 353 } */ *ap; 354{ 355 struct thread *td = ap->a_td; 356 struct ucred *cred = td->td_ucred; 357 struct vnode *vp = ap->a_vp; 358 struct smbnode *np = VTOSMB(vp); 359 struct smb_cred scred; 360 struct vattr va; 361 362 SMBVDEBUG("%s: %d\n", VTOSMB(vp)->n_name, vrefcnt(vp)); 363 if ((np->n_flag & NOPEN) != 0) { 364 smb_makescred(&scred, td, cred); 365 smbfs_vinvalbuf(vp, td); 366 if (vp->v_type == VREG) { 367 VOP_GETATTR(vp, &va, cred, td); 368 smbfs_smb_close(np->n_mount->sm_share, np->n_fid, 369 &np->n_mtime, &scred); 370 } else if (vp->v_type == VDIR) { 371 if (np->n_dirseq != NULL) { 372 smbfs_findclose(np->n_dirseq, &scred); 373 np->n_dirseq = NULL; 374 } 375 } 376 np->n_flag &= ~NOPEN; 377 smbfs_attr_cacheremove(vp); 378 } 379 VOP_UNLOCK(vp, 0, td); 380 if (np->n_flag & NGONE)
|