From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andreas Dilger <adilger@sun.com>
Cc: 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: Mon, 15 Mar 2010 16:34:54 +0000 [thread overview]
Message-ID: <20100315163454.GV30031@ZenIV.linux.org.uk> (raw)
In-Reply-To: <AEFA39B9-7F8A-4F55-8268-991F1DF098BB@sun.com>
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.
next prev parent reply other threads:[~2010-03-15 16:34 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 [this message]
2010-03-15 20:23 ` Francis Moreau
2010-03-16 6:53 ` Ian Kent
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=20100315163454.GV30031@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adilger@sun.com \
--cc=francis.moro@gmail.com \
--cc=linux-fsdevel@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 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.