From: Marcus Meissner <Marcus.Meissner@caldera.de>
To: trond.myklebust@fys.uio.no, linux-kernel@vger.kernel.org
Cc: okir@caldera.de
Subject: BUG: 2.4.x NFS client mmap race
Date: Sat, 2 Jun 2001 23:17:37 +0200 [thread overview]
Message-ID: <20010602231737.A1300@caldera.de> (raw)
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");
}
reply other threads:[~2001-06-02 21:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010602231737.A1300@caldera.de \
--to=marcus.meissner@caldera.de \
--cc=linux-kernel@vger.kernel.org \
--cc=okir@caldera.de \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox