All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Bauer <dfnsonfsduifb@gmx.de>
To: dm-devel@redhat.com
Subject: dmsetup remove gives EBUSY (even though it shouldn't be busy)
Date: Mon, 25 May 2015 00:31:25 +0200	[thread overview]
Message-ID: <5562513D.3080203@gmx.de> (raw)

Hi list,

apologies if I'm at the wrong place, but I think this is dm related
(even though in practice the device I'm talking about is using the
dm-crypt target).

This is my problem: I have a open dm-crypt mapping (LUKS) on which I do
perform some block operations (copying). There are no mounted file
systems on the copied device handles at any time. Let's say my device is
called under /dev/mapper/foobar and I'm writing to that block device.

The file descriptor that points to the /dev/mapper/foobar is then closed
via close(2). Then I call sync(2).

Afterwards I fork/exec the command "dmsetup remove foobar". This yields:

device-mapper: remove ioctl on foobar failed: Device or resource busy
Command failed

And results in return code 1. I'm only getting this behavior with slow
disks (i.e. cannot reproduce with a loop device that points to /dev/shm
as underlying block device). And I'm guessing there's some
buffers/caches still in use (i.e. pending writes) which is why dmsetup
returns EBUSY. What I don't understand is why the sync(2) call does not
block until all pending writes have been flushed.

If I do insert sleep(10) before my "dmsetup remove" call, it works
smoothly -- but this is hardly a solution.

Do you have any pointers on why this happens and how I can cleanly solve
this?

Thank you very much,
Cheers,
Johannes

             reply	other threads:[~2015-05-24 22:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 22:31 Johannes Bauer [this message]
2015-05-25 12:38 ` dmsetup remove gives EBUSY (even though it shouldn't be busy) Milan Broz
2015-06-15 18:22   ` Johannes Bauer

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=5562513D.3080203@gmx.de \
    --to=dfnsonfsduifb@gmx.de \
    --cc=dm-devel@redhat.com \
    /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.