From: Ian Kent <raven@themaw.net>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.com>,
Francis Moreau <francis.moro@gmail.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: sys_umount() returns EBUSY when doing: sh -c "mount /dev/sdc1 /mnt; umount /mnt"
Date: Tue, 16 Mar 2010 14:53:31 +0800 [thread overview]
Message-ID: <1268722411.2269.34.camel@localhost> (raw)
In-Reply-To: <20100315163454.GV30031@ZenIV.linux.org.uk>
On Mon, 2010-03-15 at 16:34 +0000, Al Viro wrote:
> On Mon, Mar 15, 2010 at 10:04:46AM -0600, Andreas Dilger wrote:
> > On 2010-03-13, at 13:30, Francis Moreau wrote:
> > >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
> >
> > Mounting an in-use filesystem is a bad idea.
>
> Huh? mount() will happily create another vfsmount refering to the same
> superblock in that case. It *is* OK to mount the same block device twice;
> any fs that uses get_sb_bdev() will DTRT.
>
> It should be safe. The lack of error checking after mount, OTOH, is not.
I started seeing similar behavior in autofs after the pnode patches went
in. I was never able to decide if I was doing something wrong or if
there had been some latency in reducing reference counts introduced.
Also, I couldn't see anything in the kernel code that that even looked
like it would cause this so I didn't see any use in reporting it.
Instead I began using a retry loop with a short delay when umounting
mounts.
Ian
next prev parent reply other threads:[~2010-03-16 6:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-13 8:56 sys_umount() returns EBUSY when doing: sh -c "mount /dev/sdc1 /mnt; umount /mnt" Francis Moreau
2010-03-13 20:30 ` Francis Moreau
2010-03-15 16:04 ` Andreas Dilger
2010-03-15 16:34 ` Al Viro
2010-03-15 20:23 ` Francis Moreau
2010-03-16 6:53 ` Ian Kent [this message]
2010-03-15 20:19 ` Francis Moreau
2010-03-14 16:21 ` Robert Hancock
2010-03-15 12:09 ` Francis Moreau
2010-03-16 11:06 ` Petr Uzel
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=1268722411.2269.34.camel@localhost \
--to=raven@themaw.net \
--cc=adilger@sun.com \
--cc=francis.moro@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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.