Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jun 1999 17:24:41 -0400 (EDT)
From:      Brian Feldman <green@unixhelp.org>
To:        hackers@FreeBSD.org
Subject:   problem for the VM gurus
Message-ID:  <Pine.BSF.4.10.9906061720010.71926-100000@janus.syracuse.net>

next in thread | raw e-mail | index | archive | help
  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                _ __ ___ ____  ___ ___ ___  
 green@unixhelp.org                _ __ ___ | _ ) __|   \ 
     FreeBSD: The Power to Serve!      _ __ | _ \._ \ |) |
         http://www.freebsd.org           _ |___)___/___/ 



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9906061720010.71926-100000>