FreeBSD/sys/kern/kern_lockf.c
/*
 * Cancel an async lock request.
 */
Cancel an async lock request.
Cancel an async lock request .
static int
lf_cancel(struct lockf *state, struct lockf_entry *lock, void *cookie)
{
	struct lockf_entry *reallock;
	LIST_FOREACH(reallock, &state->ls_pending, lf_link) {
		if ((void *) reallock == cookie) {
			if (!(reallock->lf_vnode == lock->lf_vnode
				&& reallock->lf_start == lock->lf_start
				&& reallock->lf_end == lock->lf_end)) {
				return (ENOENT);
			}
			if (!reallock->lf_async_task) {
				return (ENOENT);
			}
			lf_cancel_lock(state, reallock);
			return (0);
		}
	}
	return (ENOENT);
}
static int lf_cancel ( struct lockf * state , struct lockf_entry * lock , void * cookie ) { struct lockf_entry * reallock ; LIST_FOREACH ( reallock , & state -> ls_pending , lf_link ) { if ( ( void * ) reallock == cookie ) { if ( ! ( reallock -> lf_vnode == lock -> lf_vnode && reallock -> lf_start == lock -> lf_start && reallock -> lf_end == lock -> lf_end ) ) { return ( ENOENT ) ; } if ( ! reallock -> lf_async_task ) { return ( ENOENT ) ; } lf_cancel_lock ( state , reallock ) ; return ( 0 ) ; } } return ( ENOENT ) ; }
Cancel an async lock request.
Cancel an async lock request .
/*
	 * We need to match this request with an existing lock
	 * request.
	 */ /*
			 * Double-check that this lock looks right
			 * (maybe use a rolling ID for the cancel
			 * cookie instead?)
			 */ /*
			 * Make sure this lock was async and then just
			 * remove it from its wait lists.
			 */ /*
			 * Note that since any other thread must take
			 * state->ls_lock before it can possibly
			 * trigger the async callback, we are safe
			 * from a race with lf_wakeup_lock, i.e. we
			 * can free the lock (actually our caller does
			 * this).
			 */ /*
	 * We didn't find a matching lock - not much we can do here.
	 */