[Bug 191593] [fcntl] F_SETFL returns EDEADLK when it shouldn't - only F_SETFLW and waiting should return EDEADLK

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jul 4 01:46:32 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191593

--- Comment #1 from Adrian Chadd <adrian at freebsd.org> ---
Here's what I'm trying with:

adrian at test3:~/work/freebsd % svn diff stable/10/src/sys/kern/
Index: stable/10/src/sys/kern/kern_lockf.c
===================================================================
--- stable/10/src/sys/kern/kern_lockf.c (revision 267627)
+++ stable/10/src/sys/kern/kern_lockf.c (working copy)
@@ -1425,6 +1425,14 @@
                        if (lockf_debug & 1)
                                lf_print("lf_setlock: deadlock", lock);
 #endif
+
+                       /*
+                        * If the lock isn't waiting, return EAGAIN
+                        * rather than EDEADLK.
+                        */
+                       if (((lock->lf_flags & F_WAIT) == 0) &&
+                           (error == EDEADLK))
+                               error = EAGAIN;
                        lf_free_lock(lock);
                        goto out;
                }

.. this seems to fix the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list