diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 6d6dc51b80db..8d5c57681fe3 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -469,6 +469,9 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep, return (EOVERFLOW); end = start + oadd; } + +retry_setlock: + /* * Avoid the common case of unlocking when inode has no locks. */ @@ -744,6 +747,11 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep, sx_destroy(&freestate->ls_lock); free(freestate, M_LOCKF); } + + if (error == EDOOFUS) { + KASSERT(ap->a_op == F_SETLK, ("EDOOFUS")); + goto retry_setlock; + } return (error); } @@ -1459,7 +1467,7 @@ lf_setlock(struct lockf *state, struct lockf_entry *lock, struct vnode *vp, lock->lf_refs++; error = sx_sleep(lock, &state->ls_lock, priority, lockstr, 0); if (lf_free_lock(lock)) { - error = EINTR; + error = EDOOFUS; goto out; }