linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* mmap on PPC removes file refcount?
@ 2007-11-20 21:35 Dave Jiang
  2007-11-26 22:30 ` Dave Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jiang @ 2007-11-20 21:35 UTC (permalink / raw)
  To: linuxppc-dev

It seems the mmap() userland call on PPC causes the kernel to lose the ref
count for the mount point. This is what I did on a prpmc2800 board (74xx) with
latest powerpc.git tree (but also seem to happen on 8548 as well).

I mounted an IDE partition. The userland test app opens a file on the mounted
partition and sits in a sleep loop while holding the file open. I call umount
on the partition and I get "device is busy" which is suppose to happen.
However, after the test app calls mmap on the file id for the opened file, I
can successfully umount even though it should still say "device is busy".  This
does not happen on x86 so I'm assuming something is going on with just PPC.

So using lsof I can list the opened files on a particular partition. When the
file is opened, it lists 1 entry. When mmaped, on x86 it would list 2 entries,
but on ppc it lists nothing. Not only did the mmaped entry not show up, the
entry caused by open disappeared as well. Also, I put a printk in do_umount()
to see what the refcount is. On x86, it would be 3 and thus causes device busy.
On PPC it is 3 when the file is openend, however if mmap is called, the
refcount becomes 2 and thus umount proceeds. It's almost as if the mmap call
wiped out the opened file entry and decremented the mount count as well.


-- 

------------------------------------------------------
Dave Jiang
Software Engineer
MontaVista Software, Inc.
http://www.mvista.com
------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mmap on PPC removes file refcount?
  2007-11-20 21:35 mmap on PPC removes file refcount? Dave Jiang
@ 2007-11-26 22:30 ` Dave Jiang
  2007-11-26 22:38   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jiang @ 2007-11-26 22:30 UTC (permalink / raw)
  To: linuxppc-dev

NM, it was a bad test causing weird behavior on PPC. :(

Dave Jiang wrote:
> It seems the mmap() userland call on PPC causes the kernel to lose the ref
> count for the mount point. This is what I did on a prpmc2800 board (74xx) with
> latest powerpc.git tree (but also seem to happen on 8548 as well).
> 
> I mounted an IDE partition. The userland test app opens a file on the mounted
> partition and sits in a sleep loop while holding the file open. I call umount
> on the partition and I get "device is busy" which is suppose to happen.
> However, after the test app calls mmap on the file id for the opened file, I
> can successfully umount even though it should still say "device is busy".  This
> does not happen on x86 so I'm assuming something is going on with just PPC.
> 
> So using lsof I can list the opened files on a particular partition. When the
> file is opened, it lists 1 entry. When mmaped, on x86 it would list 2 entries,
> but on ppc it lists nothing. Not only did the mmaped entry not show up, the
> entry caused by open disappeared as well. Also, I put a printk in do_umount()
> to see what the refcount is. On x86, it would be 3 and thus causes device busy.
> On PPC it is 3 when the file is openend, however if mmap is called, the
> refcount becomes 2 and thus umount proceeds. It's almost as if the mmap call
> wiped out the opened file entry and decremented the mount count as well.
> 
> 


-- 

------------------------------------------------------
Dave Jiang
Software Engineer
MontaVista Software, Inc.
http://www.mvista.com
------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mmap on PPC removes file refcount?
  2007-11-26 22:30 ` Dave Jiang
@ 2007-11-26 22:38   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-26 22:38 UTC (permalink / raw)
  To: Dave Jiang; +Cc: linuxppc-dev


On Mon, 2007-11-26 at 15:30 -0700, Dave Jiang wrote:
> NM, it was a bad test causing weird behavior on PPC. :(

Ah good, because I did spend some time looking at the code and didn't
see anything wrong :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-26 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-20 21:35 mmap on PPC removes file refcount? Dave Jiang
2007-11-26 22:30 ` Dave Jiang
2007-11-26 22:38   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).