public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BUG: 2.4.x NFS client mmap race
@ 2001-06-02 21:17 Marcus Meissner
  0 siblings, 0 replies; only message in thread
From: Marcus Meissner @ 2001-06-02 21:17 UTC (permalink / raw)
  To: trond.myklebust, linux-kernel; +Cc: okir

Hi,

While debugging a rather strange WINE problem I came across a 2.4.x 
NFS race condition.

I trimmed down the WINE code to a very small testcase, attached below, 
which has following test patterns:
	
	ext2 local			: SUCCESS
	2.4.5-ac6  -> 2.2.10 (unfsd)	: FAIL
	2.4.2-ac26 -> 2.4.2ac26	(knfsd)	: FAIL
	2.2.14     -> 2.4.2ac26	(knfsd)	: SUCCESS

For me this looks like there is a problem in the 2.4 NFS client.

The sleep() appears to be a key part. If we only sleep 1 second the
test usually succeeds. With 5 it always fails.

I am using the default mount options for nfs.

Ciao, Marcus

#include <stdio.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>

main() {
    int fd;
    unsigned char *ptr;
    char buf[10];

    memset(buf,'0',10);

    fd = open("/home/lstcore/mm/test.out",O_RDWR|O_CREAT|O_TRUNC,0644);
    assert(fd!=-1);


    ftruncate(fd,512);
    ptr=mmap(NULL,512,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
    ptr[0]=0x42;
    munmap(ptr,512);

    sleep(5);

    ftruncate(fd,69632);
    ptr=mmap(NULL,69632,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
    assert(ptr[0]==0x42);

    fprintf(stderr,"There was no race. Lucky you!\n");
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-02 21:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-02 21:17 BUG: 2.4.x NFS client mmap race Marcus Meissner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox