|
List Info
Thread: munmap(2) fails on previously mmaped large files
|
|
| munmap(2) fails on previously mmaped
large files |
  France |
2007-05-11 14:08:44 |
Hi,
I just encountered a problem where munmap(2) fails for large
files
that were successfully mmaped ...
njoly lanfeust [embl/blastwu]> uname -a
NetBSD lanfeust.sis.pasteur.fr 4.99.19 NetBSD 4.99.19
(LANFEUST_DEVEL) #156: Thu May 10 11:15:46 CEST 2007
njoly lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/s
ys/arch/amd64/compile/LANFEUST_DEVEL amd64
njoly lanfeust [embl/blastwu]> ls -l embl.*
-rw-r--r-- 1 997 997 12882733250 May 9 00:17 embl.xnd
-rw-r--r-- 1 997 997 42205936685 May 9 00:17 embl.xns
-rw-r--r-- 1 997 997 914661870 May 9 00:17 embl.xnt
njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xnt
njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xnd
mmap: munmap failed: Invalid argument
njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xns
mmap: munmap failed: Invalid argument
Here follow the ktrace output for the last command:
8950 1 mmap CALL
open(0x7f7fffffed19,0,0x7f7fffffeba0)
8950 1 mmap NAMI "./embl.xns"
8950 1 mmap RET open 3
8950 1 mmap CALL __fstat30(3,0x7f7fffffeaa0)
8950 1 mmap RET __fstat30 0
8950 1 mmap CALL mmap(0,0x9d3ab7c2d,1,1,3,0,0)
8950 1 mmap RET mmap
140145487806464/0x7f762a048000
8950 1 mmap CALL
munmap(0x7f762a048000,0x9d3ab7c2d)
8950 1 mmap RET munmap -1 errno 22 Invalid
argument
Thanks in advance.
NB: Just in case, this is a NFS mounted directory.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
|
|
|
| Re: munmap(2) fails on previously mmaped
large files |
  Finland |
2007-05-11 14:35:22 |
On Fri May 11 2007 at 21:08:44 +0200, Nicolas Joly wrote:
> njoly lanfeust [embl/blastwu]> ls -l embl.*
> -rw-r--r-- 1 997 997 12882733250 May 9 00:17
embl.xnd
> -rw-r--r-- 1 997 997 42205936685 May 9 00:17
embl.xns
> -rw-r--r-- 1 997 997 914661870 May 9 00:17
embl.xnt
>
> njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xnt
> njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xnd
> mmap: munmap failed: Invalid argument
> njoly lanfeust [embl/blastwu]> ~/mmap ./embl.xns
> mmap: munmap failed: Invalid argument
>
> Here follow the ktrace output for the last command:
>
> 8950 1 mmap CALL
open(0x7f7fffffed19,0,0x7f7fffffeba0)
> 8950 1 mmap NAMI "./embl.xns"
> 8950 1 mmap RET open 3
> 8950 1 mmap CALL
__fstat30(3,0x7f7fffffeaa0)
> 8950 1 mmap RET __fstat30 0
> 8950 1 mmap CALL
mmap(0,0x9d3ab7c2d,1,1,3,0,0)
> 8950 1 mmap RET mmap
140145487806464/0x7f762a048000
> 8950 1 mmap CALL
munmap(0x7f762a048000,0x9d3ab7c2d)
> 8950 1 mmap RET munmap -1 errno 22 Invalid
argument
Does the following patch help? FWIW, I have no idea why the
check is
in there.
Index: uvm_mmap.c
============================================================
=======
RCS file: /cvsroot/src/sys/uvm/uvm_mmap.c,v
retrieving revision 1.108
diff -u -p -r1.108 uvm_mmap.c
--- uvm_mmap.c 4 Mar 2007 06:03:48 -0000 1.108
+++ uvm_mmap.c 11 May 2007 19:34:10 -0000
 -664,8
+664,6  sys_munmap(struct lwp *l, void *v, regis
size += pageoff;
size = (vsize_t)round_page(size);
- if ((int)size < 0)
- return (EINVAL);
if (size == 0)
return (0);
--
Antti Kantee <pooka iki.fi> Of course
he runs NetBSD
http://www.iki.fi/pooka/
http://www.NetBSD.org/
"la qualité la plus indispensable du cuisinier est
l'exactitude"
|
|
| Re: munmap(2) fails on previously mmaped
large files |
  France |
2007-05-11 14:53:55 |
On Fri, May 11, 2007 at 10:35:22PM +0300, Antti Kantee
wrote:
> On Fri May 11 2007 at 21:08:44 +0200, Nicolas Joly
wrote:
> > njoly lanfeust [embl/blastwu]> ls -l embl.*
> > -rw-r--r-- 1 997 997 12882733250 May 9 00:17
embl.xnd
> > -rw-r--r-- 1 997 997 42205936685 May 9 00:17
embl.xns
> > -rw-r--r-- 1 997 997 914661870 May 9 00:17
embl.xnt
> >
> > njoly lanfeust [embl/blastwu]> ~/mmap
./embl.xnt
> > njoly lanfeust [embl/blastwu]> ~/mmap
./embl.xnd
> > mmap: munmap failed: Invalid argument
> > njoly lanfeust [embl/blastwu]> ~/mmap
./embl.xns
> > mmap: munmap failed: Invalid argument
> >
> > Here follow the ktrace output for the last
command:
> >
> > 8950 1 mmap CALL
open(0x7f7fffffed19,0,0x7f7fffffeba0)
> > 8950 1 mmap NAMI
"./embl.xns"
> > 8950 1 mmap RET open 3
> > 8950 1 mmap CALL
__fstat30(3,0x7f7fffffeaa0)
> > 8950 1 mmap RET __fstat30 0
> > 8950 1 mmap CALL
mmap(0,0x9d3ab7c2d,1,1,3,0,0)
> > 8950 1 mmap RET mmap
140145487806464/0x7f762a048000
> > 8950 1 mmap CALL
munmap(0x7f762a048000,0x9d3ab7c2d)
> > 8950 1 mmap RET munmap -1 errno 22
Invalid argument
>
> Does the following patch help? FWIW, I have no idea
why the check is
> in there.
Yes, thanks.
> - if ((int)size < 0)
> - return (EINVAL);
In the mean time, i had a look to sys_mmap() and noticed a
similar
check, except that the cast was not `int' but `ssize_t' ...
and this
solved the problem too.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
|
|
| Re: munmap(2) fails on previously mmaped
large files |
  France |
2007-05-11 17:27:30 |
On Fri, May 11, 2007 at 08:55:17PM +0000, Christos Zoulas
wrote:
> In article <20070511190844.GA373397 medusa.sis.pasteur.fr>,
> Nicolas Joly <njoly pasteur.fr> wrote:
[...]
> >I just encountered a problem where munmap(2) fails
for large files
> >that were successfully mmaped ...
[...]
> cvs update.
Problem gone.
Thanks a lot.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
|
|
[1-4]
|
|