From: Petr Uzel <petr.uzel@suse.cz>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: sys_umount() returns EBUSY when doing: sh -c "mount /dev/sdc1 /mnt; umount /mnt"
Date: Tue, 16 Mar 2010 12:06:35 +0100 [thread overview]
Message-ID: <20100316110635.GB23066@foxbat.suse.cz> (raw)
In-Reply-To: <38b2ab8a1003150509i4a9e7e1dqce2bfb11557d403d@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2059 bytes --]
On Mon, Mar 15, 2010 at 01:09:30PM +0100, Francis Moreau wrote:
> On Sun, Mar 14, 2010 at 5:21 PM, Robert Hancock <hancockrwd@gmail.com> wrote:
> > On 03/13/2010 02:56 AM, Francis Moreau wrote:
> >> Hello
> >>
> >> I've some shell scripts which try to find out the filesystem hosted by
> >> a block device.
> >>
> >> They basically do this:
> >>
> >> mount /dev/sdc1 /mnt
> >> fs=$(stat -f -c %T $mount_point)
> >> umount /mnt
> >>
> >> It happens to work but since an unknown upgrade (kernel, libs or tools
> >> upgrade), umount(8) returns -EBUSY.
> >>
> >> I found that it's actually the sys_umount() which return -EBUSY.
> >>
> >> So the question, is this expected or is this a regression ?
> >>
> >> If it's expected then which operation should I add between the
> >> mount(8) and umount(8) to make the mount operation completely finish
> >> (inside the kernel) so the next umount won't return -EBUSY ?
> >
> > If no other process were involved I would say it's likely a bug. However, my
> > guess is that some other process (HAL, something in GNOME, etc.) detects the
> > mount and decides to start accessing the drive. Then when you immediately
> > try to unmount, it fails because it's busy. I suspect if you try this in
> > single-user mode with no unnecessary processes running you won't see this.
> >
I have experienced something similar when I did addpart, immediately
followed by delpart. The delpart command failed with EBUSY, because
the first command triggered some hal subprocess that accessed the
device.
> You're right, I don't see this anymore if I'm booting in a single user mode.
You can try to put 'lsof /dev/sdc1' between mount and umount to see
what (if anything) is accessing the device.
>
> So I need to find out how to wait until these other processes stop
> accessing the drive.
If it is hal what causes EBUSY, you could 'killall -SIGSTOP haldaemon'
before mount and SIGCONT after umount.
Petr
--
Petr Uzel, openSUSE Boosters Team
IRC: ptr_uzl @ freenode
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
prev parent reply other threads:[~2010-03-16 11:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-13 8:56 Francis Moreau
2010-03-14 16:21 ` Robert Hancock
2010-03-15 12:09 ` Francis Moreau
2010-03-16 11:06 ` Petr Uzel [this message]
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=20100316110635.GB23066@foxbat.suse.cz \
--to=petr.uzel@suse.cz \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®