364 |
else |
else |
365 |
{ |
{ |
366 |
mach_port_deallocate (mach_task_self (), fsidport); |
mach_port_deallocate (mach_task_self (), fsidport); |
367 |
mutex_lock (&idport_ihash_lock); |
if (fsidport == netfs_fsys_identity) |
|
*np = ihash_find (&idport_ihash, idport); |
|
|
if (*np != 0) |
|
368 |
{ |
{ |
369 |
/* We already know about this node. */ |
/* Talking to ourselves! We just looked up one of our own nodes. |
370 |
|
Find the node and return it. */ |
371 |
|
struct protid *cred = ports_lookup_port (netfs_port_bucket, file, |
372 |
|
netfs_protid_class); |
373 |
mach_port_deallocate (mach_task_self (), idport); |
mach_port_deallocate (mach_task_self (), idport); |
374 |
mach_port_deallocate (mach_task_self (), file); |
mach_port_deallocate (mach_task_self (), file); |
375 |
|
if (cred == 0) |
376 |
|
return EGRATUITOUS; |
377 |
|
*np = cred->po->np; |
378 |
netfs_nref (*np); |
netfs_nref (*np); |
379 |
mutex_unlock (&idport_ihash_lock); |
ports_port_deref (cred); |
380 |
} |
} |
381 |
else |
else |
382 |
{ |
{ |
383 |
mutex_unlock (&idport_ihash_lock); |
mutex_lock (&idport_ihash_lock); |
384 |
err = new_node (file, idport, flags, np); |
*np = ihash_find (&idport_ihash, idport); |
385 |
|
if (*np != 0) |
386 |
|
{ |
387 |
|
/* We already know about this node. */ |
388 |
|
mach_port_deallocate (mach_task_self (), idport); |
389 |
|
mach_port_deallocate (mach_task_self (), file); |
390 |
|
netfs_nref (*np); |
391 |
|
mutex_unlock (&idport_ihash_lock); |
392 |
|
} |
393 |
|
else |
394 |
|
{ |
395 |
|
mutex_unlock (&idport_ihash_lock); |
396 |
|
err = new_node (file, idport, flags, np); |
397 |
|
} |
398 |
} |
} |
399 |
} |
} |
400 |
} |
} |