[Pvfs2-developers] trouble with shared memory regions

Robert Latham robl at mcs.anl.gov
Wed May 31 15:47:55 EDT 2006


Hi

We have had nightly test failures on lain (one of our test machines.
It's running Debian testing).   The failures are related to berkely
DB's use of shared memory regions, but more specifically, the failures
lie with shared memory routines in general on lain.

The following small test program works ok on several other machines:

#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char ** argv)
{
	int ret;
	ret = shmget(646567223, 1024, IPC_CREAT); 
	if (ret == -1) {
		perror("shmget");
		return -1;
	}

	ret = shmctl(ret, IPC_RMID, 0);
	if (ret == -1){
		perror("shmctl");
		return -1;
	}
	return 0;
}

strace shows me that shmget(2) returns a shared memory region and
shmctl(2) sets the "remove on exit" flag. everything's cool. 

On lain, however, shmctl(2) returns EPERM.  This is different from the
error returned when db tries to call shmctl (EAGAIN), but does suggest
some sort of broader shared memory problem.  

I don't know a whole lot about shared memory regions.  Can anyone
suggest what's wrong with the test program, or why it might fail?
lain does have a tmpfs mounted on /dev/shm, and /dev/shm has the same
permissions as on other machines. the kernel has SYSV IPC support
built in. 

==rob


-- 
Rob Latham
Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
Argonne National Labs, IL USA                B29D F333 664A 4280 315B


More information about the Pvfs2-developers mailing list