11040 int caller_found;
11041 int error;
11042 rnode4_t *rp;
11043 nfs4_delmap_args_t *dmapp;
11044 nfs4_delmapcall_t *delmap_call;
11045
11046 if (vp->v_flag & VNOMAP)
11047 return (ENOSYS);
11048
11049 /*
11050 * A process may not change zones if it has NFS pages mmap'ed
11051 * in, so we can't legitimately get here from the wrong zone.
11052 */
11053 ASSERT(nfs_zone() == VTOMI4(vp)->mi_zone);
11054
11055 rp = VTOR4(vp);
11056
11057 /*
11058 * The way that the address space of this process deletes its mapping
11059 * of this file is via the following call chains:
11060 * - as_free()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs4_delmap()
11061 * - as_unmap()->SEGOP_UNMAP()/segvn_unmap()->VOP_DELMAP()/nfs4_delmap()
11062 *
11063 * With the use of address space callbacks we are allowed to drop the
11064 * address space lock, a_lock, while executing the NFS operations that
11065 * need to go over the wire. Returning EAGAIN to the caller of this
11066 * function is what drives the execution of the callback that we add
11067 * below. The callback will be executed by the address space code
11068 * after dropping the a_lock. When the callback is finished, since
11069 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
11070 * is called again on the same segment to finish the rest of the work
11071 * that needs to happen during unmapping.
11072 *
11073 * This action of calling back into the segment driver causes
11074 * nfs4_delmap() to get called again, but since the callback was
11075 * already executed at this point, it already did the work and there
11076 * is nothing left for us to do.
11077 *
11078 * To Summarize:
11079 * - The first time nfs4_delmap is called by the current thread is when
11080 * we add the caller associated with this delmap to the delmap caller
11081 * list, add the callback, and return EAGAIN.
|
11040 int caller_found;
11041 int error;
11042 rnode4_t *rp;
11043 nfs4_delmap_args_t *dmapp;
11044 nfs4_delmapcall_t *delmap_call;
11045
11046 if (vp->v_flag & VNOMAP)
11047 return (ENOSYS);
11048
11049 /*
11050 * A process may not change zones if it has NFS pages mmap'ed
11051 * in, so we can't legitimately get here from the wrong zone.
11052 */
11053 ASSERT(nfs_zone() == VTOMI4(vp)->mi_zone);
11054
11055 rp = VTOR4(vp);
11056
11057 /*
11058 * The way that the address space of this process deletes its mapping
11059 * of this file is via the following call chains:
11060 * - as_free()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs4_delmap()
11061 * - as_unmap()->segop_unmap()/segvn_unmap()->VOP_DELMAP()/nfs4_delmap()
11062 *
11063 * With the use of address space callbacks we are allowed to drop the
11064 * address space lock, a_lock, while executing the NFS operations that
11065 * need to go over the wire. Returning EAGAIN to the caller of this
11066 * function is what drives the execution of the callback that we add
11067 * below. The callback will be executed by the address space code
11068 * after dropping the a_lock. When the callback is finished, since
11069 * we dropped the a_lock, it must be re-acquired and segvn_unmap()
11070 * is called again on the same segment to finish the rest of the work
11071 * that needs to happen during unmapping.
11072 *
11073 * This action of calling back into the segment driver causes
11074 * nfs4_delmap() to get called again, but since the callback was
11075 * already executed at this point, it already did the work and there
11076 * is nothing left for us to do.
11077 *
11078 * To Summarize:
11079 * - The first time nfs4_delmap is called by the current thread is when
11080 * we add the caller associated with this delmap to the delmap caller
11081 * list, add the callback, and return EAGAIN.
|