Re: [PATCH] loop: clear read-only flag in loop_clr_fd.

From: Tao Ma
Date: Sun Feb 13 2011 - 10:06:34 EST


On 02/13/2011 10:11 PM, Milan Broz wrote:
On 02/13/2011 11:58 AM, Tao Ma wrote:
From: Tao Ma<boyu.mt@xxxxxxxxxx>

In 75f1dc0, we check bdev_read_only() from blkdev_get().
But the loop_clr_fd doesn't clear the read only flag.
What cause a error if we changing a loop device from
read only to writable.
No, sorry, this is not proper/complete fix. It fixes it for loop
(and even not completely - you are missing some error
paths and ignoring autoclear mode where you have bdev NULL.)
(And yes, I tried the same as workaround.)
aha, sorry, I don't know you are more familiar with loop than me. ;)
I just did a quick test and sent the patch. So could you please tell me
a little more about how we use autoclear mode? I just googled but can't
find some helpful information. I will try to update my patch with a V2 when
I get familiar with the whole stuff.
And it will not help for DM case (and possibly others).
Actually I don't think it is Tejun's patch that causes the bug. What his patch do
is to expose some bugs that already exist. Say loop, it sets ro when it get read
only flags, but doesn't clear it when it is detached. It should be loop's problem,
not blkdev's. As for the DM case, I guess it should also be related to DM part.

Regards,
Tao
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/