linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Eric Sandeen <sandeen@sandeen.net>,
	Eric Sandeen <sandeen@redhat.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Cc: Jes.Sorensen@redhat.com
Subject: Re: [PATCH] block: return EBUSY from drop_partitions on mounted whole disk device
Date: Wed, 2 Mar 2016 15:15:44 -0700	[thread overview]
Message-ID: <56D76610.4050207@kernel.dk> (raw)
In-Reply-To: <56D76575.6050901@sandeen.net>

On 03/02/2016 03:13 PM, Eric Sandeen wrote:
>
>
> On 3/1/16 2:45 PM, Eric Sandeen wrote:
>> On 8/5/15 2:13 PM, Eric Sandeen wrote:
>>> The BLKRRPART ioctl already fails today if any partition under
>>> the device is mounted.  However, if we mkfs a whole disk and mount
>>> it, BLKRRPART happily proceeds down the invalidation path, which
>>> seems like a bad idea.
>>>
>>> Check whether the whole device is mounted by checking bd_super,
>>> and return -EBUSY if so.
>>>
>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>>> ---
>>>
>>> I don't know for sure if this is the right approach, but figure
>>> I'll ask in the form of a patch.  ;)
>>
>> I'm now thinking that this is not the right approach.  :(  I got a
>> bug report stating that during some md raid1 testing with replacing
>> failed disks, filesystems were losing data.  I haven't reproduced
>> that part yet, but...
>>
>> It's hitting the "bd_super" case added in the patch below, and returning
>> -EBUSY to md when mdadm tries to to remove a disk:
>>
>> # mdadm /dev/md0 -r /dev/loop0
>> mdadm: hot remove failed for /dev/loop0: Device or resource busy
>
> FWIW, just ignore me, I was being an idiot.  a) the patch *prevents*
> the corruption; does not cause it; without the EBUSY, drop_partitions
> will get to invalidate_inodes() etc, and no wonder data is lost.
> And b) the above EBUSY is because I forgot to fail the disk first. :/
>
> Nothing to see here, move along, sorry!

Still beats a regression :-)

-- 
Jens Axboe


      reply	other threads:[~2016-03-02 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 19:13 [PATCH] block: return EBUSY from drop_partitions on mounted whole disk device Eric Sandeen
2016-03-01 20:45 ` Eric Sandeen
2016-03-02  3:38   ` Eric Sandeen
2016-03-02 22:13   ` Eric Sandeen
2016-03-02 22:15     ` Jens Axboe [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=56D76610.4050207@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Jes.Sorensen@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /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).