All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] dm: separate device deletion from dm_put()
@ 2010-06-08 10:21 Kiyoshi Ueda
  2010-06-08 10:25 ` [PATCH 1/3] dm: prevent access to md being deleted Kiyoshi Ueda
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kiyoshi Ueda @ 2010-06-08 10:21 UTC (permalink / raw)
  To: Alasdair Kergon; +Cc: device-mapper development

Hi Alasdair,

This is an updated patch-set to fix bugs in device removal corner-cases,
replacing the previous version found in:
  https://patchwork.kernel.org/patch/83995/

Please review and take this patch-set instead.
This patch-set can be applied on top of 2.6.35-rc1 + your NEXT_PATCHES.

The patch-set contains 3 patches:
The 3rd patch is basically same as the one I posted before.
The 1st patch is a new patch fixing possible NULL pointer dereference.
The 2nd patch fixes a deadlock, which is introduced by the 3rd patch.

The deadlock is AB-BA deadlock between dm_hash_remove_all(), which waits
for md->holders to be 0 with _hash_lock held, and other ioctls which waits
for _hash_lock with md->holders held (e.g. table_status(), table_load()):
  CPU0                            CPU1
  ------------------------------------------------------------------
  dm_hash_remove_all()
    down_write(_hash_lock)
                                  table_status()
                                    md = find_device()
                                           dm_get(md)
                                    dm_get_live_or_inactive_table()
                                      dm_get_inactive_table()
                                        down_write(_hash_lock)
    dm_destroy(md)
      while (md->holders)
        msleep(1)

To fix this deadlock problem, this patch-set changes dm_hash_remove_all()
to release _hash_lock when removing a mapped_device, then, take _hash_lock
and start over again.

Summary of the patch-set:
  1/3: dm: prevent access to md being deleted
  2/3: dm: release _hash_lock when removing device in remove_all
  3/3: dm: separate device deletion from dm_put()

 drivers/md/dm-ioctl.c |   61 ++++++++++++++++++++++++++++----------------------
 drivers/md/dm.c       |   60 ++++++++++++++++++++++++++++++++++++-------------
 drivers/md/dm.h       |    5 ++++
 3 files changed, 84 insertions(+), 42 deletions(-)

Thanks,
Kiyoshi Ueda

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-03  7:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 10:21 [PATCH 0/3] dm: separate device deletion from dm_put() Kiyoshi Ueda
2010-06-08 10:25 ` [PATCH 1/3] dm: prevent access to md being deleted Kiyoshi Ueda
2010-06-08 10:26 ` [PATCH 2/3] dm: release _hash_lock when removing device in remove_all Kiyoshi Ueda
2010-06-08 10:27 ` [PATCH 3/3] dm: separate device deletion from dm_put() Kiyoshi Ueda
2010-07-23 17:59   ` Alasdair G Kergon
2010-08-03  7:19     ` Kiyoshi Ueda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.