5558 {
5559 int caller_found;
5560 int error;
5561 rnode_t *rp;
5562 nfs_delmap_args_t *dmapp;
5563 nfs_delmapcall_t *delmap_call;
5564
5565 if (vp->v_flag & VNOMAP)
5566 return (ENOSYS);
5567 /*
5568 * A process may not change zones if it has NFS pages mmap'ed
5569 * in, so we can't legitimately get here from the wrong zone.
5570 */
5571 ASSERT(nfs_zone() == VTOMI(vp)->mi_zone);
5572
5573 rp = VTOR(vp);
5574
5575 /*
5576 * The way that the address space of this process deletes its mapping
5577 * of this file is via the following call chains:
5578 * - as_free()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs3_delmap()
5579 * - as_unmap()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs3_delmap()
5580 *
5581 * With the use of address space callbacks we are allowed to drop the
5582 * address space lock, a_lock, while executing the NFS operations that
5583 * need to go over the wire. Returning EAGAIN to the caller of this
5584 * function is what drives the execution of the callback that we add
5585 * below. The callback will be executed by the address space code
5586 * after dropping the a_lock. When the callback is finished, since
5587 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
5588 * is called again on the same segment to finish the rest of the work
5589 * that needs to happen during unmapping.
5590 *
5591 * This action of calling back into the segment driver causes
5592 * nfs3_delmap() to get called again, but since the callback was
5593 * already executed at this point, it already did the work and there
5594 * is nothing left for us to do.
5595 *
5596 * To Summarize:
5597 * - The first time nfs3_delmap is called by the current thread is when
5598 * we add the caller associated with this delmap to the delmap caller
5599 * list, add the callback, and return EAGAIN.
|
5558 {
5559 int caller_found;
5560 int error;
5561 rnode_t *rp;
5562 nfs_delmap_args_t *dmapp;
5563 nfs_delmapcall_t *delmap_call;
5564
5565 if (vp->v_flag & VNOMAP)
5566 return (ENOSYS);
5567 /*
5568 * A process may not change zones if it has NFS pages mmap'ed
5569 * in, so we can't legitimately get here from the wrong zone.
5570 */
5571 ASSERT(nfs_zone() == VTOMI(vp)->mi_zone);
5572
5573 rp = VTOR(vp);
5574
5575 /*
5576 * The way that the address space of this process deletes its mapping
5577 * of this file is via the following call chains:
5578 * - as_free()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs3_delmap()
5579 * - as_unmap()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs3_delmap()
5580 *
5581 * With the use of address space callbacks we are allowed to drop the
5582 * address space lock, a_lock, while executing the NFS operations that
5583 * need to go over the wire. Returning EAGAIN to the caller of this
5584 * function is what drives the execution of the callback that we add
5585 * below. The callback will be executed by the address space code
5586 * after dropping the a_lock. When the callback is finished, since
5587 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
5588 * is called again on the same segment to finish the rest of the work
5589 * that needs to happen during unmapping.
5590 *
5591 * This action of calling back into the segment driver causes
5592 * nfs3_delmap() to get called again, but since the callback was
5593 * already executed at this point, it already did the work and there
5594 * is nothing left for us to do.
5595 *
5596 * To Summarize:
5597 * - The first time nfs3_delmap is called by the current thread is when
5598 * we add the caller associated with this delmap to the delmap caller
5599 * list, add the callback, and return EAGAIN.
|