lkml.org 
[lkml]   [2011]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] loop: clear read-only flag in loop_clr_fd.
    On 02/13/2011 04:05 PM, Tao Ma wrote:
    > 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@taobao.com>
    >>>
    >>> 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?

    When the autoclear flag is set, the loop device is deallocated with
    the last close. So you can mount device over loop and after umount
    the loop is automatically cleared (no need for losetup -d).
    (I think this flag was not exported to losetup yet, so you need to use
    ioctl flag yourself.)

    > I will try to update my patch with a V2 when I get familiar with the whole stuff.

    I would like Tejun tell us what the intention was here.
    There are some paths which are not so clear (this one in loop device is easy),
    so that code need to be audited.

    > Actually I don't think it is Tejun's patch that causes the bug.

    It is quite possible. But it worked before and this patch did not
    fix these problems, so it is regression.

    > Say loop, it sets ro when it get read only flags, but doesn't clear it when it is detached.

    You can very easily create another bug here if you set device read-write
    too early (while udev is still processing change/remove events).

    Milan


    \
     
     \ /
      Last update: 2011-02-13 17:47    [W:2.394 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site