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