Skip to content
  • Alasdair G Kergon's avatar
    [PATCH] dm: prevent removal if open · 5c6bd75d
    Alasdair G Kergon authored
    
    
    If you misuse the device-mapper interface (or there's a bug in your userspace
    tools) it's possible to end up with 'unlinked' mapped devices that cannot be
    removed until you reboot (along with uninterruptible processes).
    
    This patch prevents you from removing a device that is still open.
    
    It introduces dm_lock_for_deletion() which is called when a device is about to
    be removed to ensure that nothing has it open and nothing further can open it.
     It uses a private open_count for this which also lets us remove one of the
    problematic bdget_disk() calls elsewhere.
    
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    5c6bd75d