All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <djiang@mvista.com>
To: linuxppc-dev@ozlabs.org
Subject: mmap on PPC removes file refcount?
Date: Tue, 20 Nov 2007 14:35:52 -0700	[thread overview]
Message-ID: <47435338.2050107@mvista.com> (raw)

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
------------------------------------------------------

             reply	other threads:[~2007-11-20 22:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 21:35 Dave Jiang [this message]
2007-11-26 22:30 ` mmap on PPC removes file refcount? Dave Jiang
2007-11-26 22:38   ` Benjamin Herrenschmidt

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=47435338.2050107@mvista.com \
    --to=djiang@mvista.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.