From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Alasdair Kergon <agk@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH 0/3] dm: separate device deletion from dm_put()
Date: Tue, 08 Jun 2010 19:21:20 +0900 [thread overview]
Message-ID: <4C0E19A0.1040804@ct.jp.nec.com> (raw)
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
next reply other threads:[~2010-06-08 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 10:21 Kiyoshi Ueda [this message]
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
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=4C0E19A0.1040804@ct.jp.nec.com \
--to=k-ueda@ct.jp.nec.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.