In the long-standing tradition of deadlocks, I present to you all a new one.
This one locks in getblk, and causes other processes to lock in inode. It's
easy to induce, but I have no idea how I'd go about fixing it myself
(being very new to that part of the kernel.)
  Here's the program which induces the deadlock:

#include <sys/types.h>
#include <sys/mman.h>

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int
main(int argc, char **argv) {
        int psize = getpagesize() * 2;
        void *tmp;
        char name[] = "m.XXXXXX";
        int fd = mkstemp(name);

        if (fd == -1) {
                perror("open");
                exit(1);
        }

        tmp = mmap(NULL, psize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
        if (tmp == MAP_FAILED) {
                perror("mmap");
                exit(1);
        }
        printf("write retval == %lld", write(fd, tmp, psize));
        unlink(name);
        exit(0);
}

 Brian Feldman                _ __ ___ ____  ___ ___ ___  
 gr...@unixhelp.org                _ __ ___ | _ ) __|   \ 
     FreeBSD: The Power to Serve!      _ __ | _ \._ \ |) |
         http://www.freebsd.org           _ |___)___/___/ 



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to