4655 {
4656 int caller_found;
4657 int error;
4658 rnode_t *rp;
4659 nfs_delmap_args_t *dmapp;
4660 nfs_delmapcall_t *delmap_call;
4661
4662 if (vp->v_flag & VNOMAP)
4663 return (ENOSYS);
4664 /*
4665 * A process may not change zones if it has NFS pages mmap'ed
4666 * in, so we can't legitimately get here from the wrong zone.
4667 */
4668 ASSERT(nfs_zone() == VTOMI(vp)->mi_zone);
4669
4670 rp = VTOR(vp);
4671
4672 /*
4673 * The way that the address space of this process deletes its mapping
4674 * of this file is via the following call chains:
4675 * - as_free()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs_delmap()
4676 * - as_unmap()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs_delmap()
4677 *
4678 * With the use of address space callbacks we are allowed to drop the
4679 * address space lock, a_lock, while executing the NFS operations that
4680 * need to go over the wire. Returning EAGAIN to the caller of this
4681 * function is what drives the execution of the callback that we add
4682 * below. The callback will be executed by the address space code
4683 * after dropping the a_lock. When the callback is finished, since
4684 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
4685 * is called again on the same segment to finish the rest of the work
4686 * that needs to happen during unmapping.
4687 *
4688 * This action of calling back into the segment driver causes
4689 * nfs_delmap() to get called again, but since the callback was
4690 * already executed at this point, it already did the work and there
4691 * is nothing left for us to do.
4692 *
4693 * To Summarize:
4694 * - The first time nfs_delmap is called by the current thread is when
4695 * we add the caller associated with this delmap to the delmap caller
4696 * list, add the callback, and return EAGAIN.
|
4655 {
4656 int caller_found;
4657 int error;
4658 rnode_t *rp;
4659 nfs_delmap_args_t *dmapp;
4660 nfs_delmapcall_t *delmap_call;
4661
4662 if (vp->v_flag & VNOMAP)
4663 return (ENOSYS);
4664 /*
4665 * A process may not change zones if it has NFS pages mmap'ed
4666 * in, so we can't legitimately get here from the wrong zone.
4667 */
4668 ASSERT(nfs_zone() == VTOMI(vp)->mi_zone);
4669
4670 rp = VTOR(vp);
4671
4672 /*
4673 * The way that the address space of this process deletes its mapping
4674 * of this file is via the following call chains:
4675 * - as_free()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs_delmap()
4676 * - as_unmap()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs_delmap()
4677 *
4678 * With the use of address space callbacks we are allowed to drop the
4679 * address space lock, a_lock, while executing the NFS operations that
4680 * need to go over the wire. Returning EAGAIN to the caller of this
4681 * function is what drives the execution of the callback that we add
4682 * below. The callback will be executed by the address space code
4683 * after dropping the a_lock. When the callback is finished, since
4684 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
4685 * is called again on the same segment to finish the rest of the work
4686 * that needs to happen during unmapping.
4687 *
4688 * This action of calling back into the segment driver causes
4689 * nfs_delmap() to get called again, but since the callback was
4690 * already executed at this point, it already did the work and there
4691 * is nothing left for us to do.
4692 *
4693 * To Summarize:
4694 * - The first time nfs_delmap is called by the current thread is when
4695 * we add the caller associated with this delmap to the delmap caller
4696 * list, add the callback, and return EAGAIN.
|