svn commit: r268384 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Tue Jul 8 08:10:16 UTC 2014
Author: kib
Date: Tue Jul 8 08:10:15 2014
New Revision: 268384
URL: http://svnweb.freebsd.org/changeset/base/268384
Log:
Correct the problem reported by test16 from
tools/regression/file/flock/flock.c, which completes the fix in
r192685. When the lock was stolen from us, retry the whole lock
sequence in kernel, instead of returning EINTR to usermode and hoping
that application would handle it correctly by restarting the lock
acquire.
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Modified:
head/sys/kern/kern_lockf.c
Modified: head/sys/kern/kern_lockf.c
==============================================================================
--- head/sys/kern/kern_lockf.c Tue Jul 8 08:05:42 2014 (r268383)
+++ head/sys/kern/kern_lockf.c Tue Jul 8 08:10:15 2014 (r268384)
@@ -469,6 +469,9 @@ lf_advlockasync(struct vop_advlockasync_
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_
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 l
lock->lf_refs++;
error = sx_sleep(lock, &state->ls_lock, priority, lockstr, 0);
if (lf_free_lock(lock)) {
- error = EINTR;
+ error = EDOOFUS;
goto out;
}
More information about the svn-src-head
mailing list