xfs
[Top] [All Lists]

Re: mmap() problem on xfs

To: misiek@xxxxxxxxxx
Subject: Re: mmap() problem on xfs
From: Steve Lord <lord@xxxxxxx>
Date: 14 Jun 2002 16:06:25 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <200206141826.g5EIQe7K022769@oss.sgi.com>
References: <200206141826.g5EIQe7K022769@oss.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
This message got blocked by a spam filter - probably the binary data
in the middle of it.

On Fri, 2002-06-14 at 13:26, you wrote:

> 
> Hi,
> 
> We have problem with mmaping files from XFS partition on
> our 2.4.18 kernels (xfs 03062002, previously 20020517), x86.
> 
> Testcase - mmapcat.c :
> #include<fcntl.h>
> #include <unistd.h>
> #include <sys/mman.h>
> #include <sys/stat.h>
> #include <stdio.h>
> 
> int main(int argc, char **argv)
> {
> int fd,n;
> char *ptr;
> struct stat st;
> fd=open(argv[1],O_RDONLY);
> if(fd<0){perror(argv[1]);exit(1);}
> fstat(fd,&st);
> if(st.st_size%4096==0){fprintf(stderr,"bad file size!\n");exit(1);}
> ptr = mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,fd,0);
> while (*ptr!=0)
> write(1,ptr++,1);
> exit(0);
> }
> 
> # mmapcat /usr/include/stdio.h gives at the end
> 
> #endif /* <stdio.h> included.  */
> 
> #endif /* !_STDIO_H */

Binary data removed.

> (some junk at the end). Sometimes mmapcat even crashes. There is no
> problem on ext2 for example.
> 
> Please try to run this simple script on your xfs partitions:
> for a in `find /usr/include -type f -print`; do
>     if [ "$(cat $a 2>&1)" != "$(./mmapcat $a 2>&1)" ]; then
>         echo "DIFFER: $a"
>     fi
> done
> 
> For me:
> [misiek@arm misiek]$ ./xfs-test.sh | grep DIFFER | wc -l
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
> Memory fault (core dumped) 
>     277


This test program works here on the current xfs code base. Which
suggests this is either something we have fixed, or a problem 
with something else in your tree.

Steve


-- 

Steve Lord                                      voice: +1-651-683-3511
Principal Engineer, Filesystem Software         email: lord@xxxxxxx


<Prev in Thread] Current Thread [Next in Thread>