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

--- Comment #57 from Konstantin Belousov <k...@freebsd.org> ---
(In reply to mike from comment #56)
Yes, that was already handled.  And, the hang there is the whole system hang.

Please apply this debugging patch and try reproduce the issue one more time.

diff --git a/lib/libc/stdio/_flock_stub.c b/lib/libc/stdio/_flock_stub.c
index 069ed64c4e9..99e1af6fbfb 100644
--- a/lib/libc/stdio/_flock_stub.c
+++ b/lib/libc/stdio/_flock_stub.c
@@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <pthread.h>
 #include "un-namespace.h"
+#include <signal.h>
+#include <unistd.h>

 #include "local.h"

@@ -116,6 +118,8 @@ _funlockfile(FILE *fp)
        /*
         * Check if this file is owned by the current thread:
         */
+       while (*(volatile struct thread * volatile *)&fp->_fl_owner == NULL)
+               ;
        if (fp->_fl_owner == curthread) {
                /*
                 * Check if this thread has locked the FILE
@@ -138,4 +142,11 @@ _funlockfile(FILE *fp)
                        _pthread_mutex_unlock(&fp->_fl_mutex);
                }
        }
+       else {
+               char x[120];
+               snprintf(x, sizeof(x), "funlockfile %p %p %p\n", fp,
+                        curthread, fp->_fl_owner);
+               write(2, x, strlen(x));
+               raise(SIGBUS);
+       }
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to