linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: "krzf83@gmail.com " <krzf83@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: after mounting with -o degraded: ioctl: LOOP_CLR_FD: Device or resource busy
Date: Tue, 12 Jul 2011 13:09:50 +0300	[thread overview]
Message-ID: <20110712100950.GA2041@zambezi.lan> (raw)
In-Reply-To: <CAJ1PRS=uL3xyJi57xz1taqh1mOYLUJDSRzUs3LsGBx7UVBG=Dg@mail.gmail.com>

On Tue, Jul 12, 2011 at 02:47:41AM +0200, krzf83@gmail.com  wrote:
> dd if=/dev/null of=img5 bs=1 seek=2G
> dd if=/dev/null of=img6 bs=1 seek=2G
> mkfs.btrfs -d raid1 -m raid1 img5 img6
> losetup /dev/loop4 img5
> losetup /dev/loop5 img6
> btrfs device scan
> mount -t btrfs /dev/loop4 dir
> umount dir
> losetup -d /dev/loop5
> mount -t btrfs -o degraded /dev/loop4 dir
> umount dir
> losetup -d /dev/loop4
> ioctl: LOOP_CLR_FD: Device or resource busy
> mkfs.ext3 /dev/loop4
> mke2fs 1.39 (29-May-2006)
> /dev/loop4 is apparently in use by the system; will not make a filesystem here!
> 
> this only happens after mouting with -o degraded. loopback device is
> unusable until next reboot

So mkfs.ext3 fails to open device with O_EXCL.

We are missing blk_put() call on error path.  At least once: if
btrfs_open_devices() fails (and it does if you e.g. zero out the
superblock on a raid1 fs while it's unmounted and then immediately
mount) it's caller never releases the other device(s).  If nobody else
steps up I can try to fix this in the next couple of days.

Thanks,

		Ilya

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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:[~2011-07-12 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12  0:47 after mounting with -o degraded: ioctl: LOOP_CLR_FD: Device or resource busy krzf83@gmail.com 
2011-07-12 10:09 ` Ilya Dryomov [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=20110712100950.GA2041@zambezi.lan \
    --to=idryomov@gmail.com \
    --cc=krzf83@gmail.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).