LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Tao Ma <tm@tao.ma>,
	linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH] loop: clear read-only flag in loop_clr_fd.
Date: Mon, 14 Feb 2011 12:47:48 +0100	[thread overview]
Message-ID: <4D591664.6090203@redhat.com> (raw)
In-Reply-To: <20110214103026.GA18742@htj.dyndns.org>


On 02/14/2011 11:30 AM, Tejun Heo wrote:
> Umm... This was reported some time ago and patches were already
> posted.  Milan, can you test whether the following two patches fix the
> problems you're seeing?  Jens, what's the status of these patches?
>
>   http://thread.gmane.org/gmane.linux.kernel/1090211/focus=1090666
>
With patch below (loop cannot be built as module) it fixes the loop problem.

But it doesn't fix the read-only snapshot issue and I guess there will be
the same problem with read-only MD code too.
(so the 2) issue here https://lkml.org/lkml/2011/2/12/209).

If the call is changed intentionally, we have to fix unconditional blkdev open
calls with read-write flag in this code.
Before doing that I would like to know if it was intentional change or not...

You can simple try this reproducer (works on older kernel, second readonly
snapshot create fails now with permission denied)
+ dmsetup create x --readonly --table '0 131072 snapshot /dev/loop0 /dev/loop1 p 8'
device-mapper: reload ioctl failed: Permission denied

#!/bin/bash -x
modprobe loop

dd if=/dev/zero of=/x.img bs=1M count=64
dd if=/dev/zero of=/xs.img bs=1M count=64
losetup /dev/loop0 /x.img
losetup /dev/loop1 /xs.img
sync
dmsetup create x --table "0 131072 snapshot /dev/loop0 /dev/loop1 p 8"
udevadm settle
dmsetup remove x

losetup -d /dev/loop0
losetup -d /dev/loop1
losetup -r /dev/loop0 /x.img
losetup -r /dev/loop1 /xs.img
dmsetup create x --readonly --table "0 131072 snapshot /dev/loop0 /dev/loop1 p 8"
dmsetup table

dmsetup remove x
losetup -d /dev/loop0
losetup -d /dev/loop1

Milan

--
Export bdgrap to allow loop module build 

Signed-off-by: Milan Broz <mbroz@redhat.com> 
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 333a7bb..c9cf9f7 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -574,6 +574,7 @@ struct block_device *bdgrab(struct block_device *bdev)
 	ihold(bdev->bd_inode);
 	return bdev;
 }
+EXPORT_SYMBOL(bdgrab);
 
 long nr_blockdev_pages(void)
 {



  reply	other threads:[~2011-02-14 11:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13  2:02 block device read-only handling regression in 2.6.38-rc4 (bisected) Milan Broz
2011-02-13 10:58 ` [PATCH] loop: clear read-only flag in loop_clr_fd Tao Ma
2011-02-13 14:11   ` Milan Broz
2011-02-13 15:05     ` Tao Ma
2011-02-13 16:44       ` Milan Broz
2011-02-14 10:30         ` Tejun Heo
2011-02-14 11:47           ` Milan Broz [this message]
2011-02-14 13:14             ` [PATCH][RFC] dm: Do not open log and cow device read-write for read-only mappings Milan Broz
2011-02-14 14:09               ` Tejun Heo
2011-02-14 14:23                 ` Milan Broz
2011-02-14 15:44                   ` Tejun Heo
2011-02-14 23:15                     ` NeilBrown
2011-02-15  2:03                       ` [dm-devel] " Alasdair G Kergon
2011-02-15 12:17                         ` Milan Broz
2011-02-15 12:46                           ` Alasdair G Kergon
2011-02-15 15:20                             ` Tejun Heo
2011-02-15 15:46                               ` Alasdair G Kergon
2011-02-15 15:50                                 ` Tejun Heo
2011-02-15 16:05                                   ` Milan Broz
2011-02-15 16:12                                     ` Tejun Heo
2011-02-15 16:36                                       ` Milan Broz
2011-02-15 16:41                                         ` Tejun Heo
2011-02-15 16:56                                           ` Alasdair G Kergon
2011-02-16  8:46                                             ` Tejun Heo
2011-02-15 16:58                                           ` Milan Broz
2011-02-16  8:39                                             ` Tejun Heo
2011-02-15 15:16                           ` [PATCH] Return EROFS if read-only detected on block device Milan Broz
2011-02-14 14:39                 ` [dm-devel] [PATCH][RFC] dm: Do not open log and cow device read-write for read-only mappings Alasdair G Kergon
2011-02-14 14:07             ` [PATCH] loop: clear read-only flag in loop_clr_fd Tejun Heo
     [not found] <glzzr-4Jt-1@gated-at.bofh.it>
     [not found] ` <glHQm-1vQ-25@gated-at.bofh.it>
2011-02-13 20:41   ` Bodo Eggert

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=4D591664.6090203@redhat.com \
    --to=mbroz@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=tm@tao.ma \
    --subject='Re: [PATCH] loop: clear read-only flag in loop_clr_fd.' \
    /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

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).