linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francis Moreau <francis.moro@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.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 21:23:02 +0100	[thread overview]
Message-ID: <38b2ab8a1003151323q6155e917ia74da84475db66f9@mail.gmail.com> (raw)
In-Reply-To: <20100315163454.GV30031@ZenIV.linux.org.uk>

On Mon, Mar 15, 2010 at 5:34 PM, Al Viro <viro@zeniv.linux.org.uk> 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.
>

Well I omitted the error checking since it was not revelant in my
case: umount(8) fails but not mount(8).

-- 
Francis
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-03-15 20:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38b2ab8a1003130056u4b025839i556a797ccad894de@mail.gmail.com>
2010-03-13 20:30 ` sys_umount() returns EBUSY when doing: sh -c "mount /dev/sdc1 /mnt; umount /mnt" Francis Moreau
2010-03-15 16:04   ` Andreas Dilger
2010-03-15 16:34     ` Al Viro
2010-03-15 20:23       ` Francis Moreau [this message]
2010-03-16  6:53       ` Ian Kent
2010-03-15 20:19     ` Francis Moreau

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=38b2ab8a1003151323q6155e917ia74da84475db66f9@mail.gmail.com \
    --to=francis.moro@gmail.com \
    --cc=adilger@sun.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 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).