All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] RFC: Changing dm core (2/5) : Put_table in safer place
Date: Thu, 16 Mar 2006 19:23:38 -0500	[thread overview]
Message-ID: <441A018A.7070301@ce.jp.nec.com> (raw)
In-Reply-To: <4419FF61.9050501@ce.jp.nec.com>

[-- Attachment #1: Type: text/plain, Size: 99 bytes --]

Move dm_table_put() outside of dm_sem.

Thanks,
-- 
Jun'ichi Nomura, NEC Solutions (America), Inc.

[-- Attachment #2: 02-put-table-after-unlock.patch --]
[-- Type: text/x-patch, Size: 1680 bytes --]

Move dm_table_put() outside of dm_sem.

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>

 dm-ioctl.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

--- linux-2.6.16-rc6-mm1-dm.01-dm-sem/drivers/md/dm-ioctl.c	2006-03-13 17:35:40.000000000 -0500
+++ linux-2.6.16-rc6-mm1-dm.02-put-table-after-unlock/drivers/md/dm-ioctl.c	2006-03-15 10:15:11.000000000 -0500
@@ -984,7 +984,7 @@ static int table_load(struct dm_ioctl *p
 {
 	int r;
 	struct hash_cell *hc;
-	struct dm_table *t;
+	struct dm_table *t, *oldmap = NULL;
 	struct mapped_device *md;
 
 	md = find_device(param);
@@ -1005,14 +1005,14 @@ static int table_load(struct dm_ioctl *p
 	hc = dm_get_mdptr(md);
 	if (!hc || hc->md != md) {
 		DMWARN("device has been removed from the dev hash table.");
-		dm_table_put(t);
+		oldmap = t;
 		up_write(&dm_sem);
 		r = -ENXIO;
 		goto out;
 	}
 
 	if (hc->new_map)
-		dm_table_put(hc->new_map);
+		oldmap = hc->new_map;
 	hc->new_map = t;
 	up_write(&dm_sem);
 
@@ -1020,6 +1020,8 @@ static int table_load(struct dm_ioctl *p
 	r = __dev_status(md, param);
 
 out:
+	if (oldmap)
+		dm_table_put(oldmap);
 	dm_put(md);
 
 	return r;
@@ -1029,6 +1031,7 @@ static int table_clear(struct dm_ioctl *
 {
 	int r;
 	struct hash_cell *hc;
+	struct dm_table *oldmap = NULL;
 
 	down_write(&dm_sem);
 
@@ -1040,7 +1043,7 @@ static int table_clear(struct dm_ioctl *
 	}
 
 	if (hc->new_map) {
-		dm_table_put(hc->new_map);
+		oldmap = hc->new_map;
 		hc->new_map = NULL;
 	}
 
@@ -1048,6 +1051,10 @@ static int table_clear(struct dm_ioctl *
 
 	r = __dev_status(hc->md, param);
 	up_write(&dm_sem);
+
+	if (oldmap)
+		dm_table_put(oldmap);
+
 	return r;
 }
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2006-03-17  0:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-17  0:14 [PATCH] RFC: Changing dm core data structure relationships (0/5) Jun'ichi Nomura
2006-03-17  0:17 ` [PATCH] RFC: Changing dm core (1/5): Make _hash_lock extern Jun'ichi Nomura
2006-03-17  0:23 ` Jun'ichi Nomura [this message]
2006-03-17  0:27 ` [PATCH] RFC: Changing dm core (3/5): hash_cell open counter Jun'ichi Nomura
2006-03-17  0:28 ` [PATCH] RFC: Changing dm core (4/5): remove dm_get_md() Jun'ichi Nomura
2006-03-17  0:29 ` [PATCH] RFC: Changing dm core: (5/5): Move new_map from hash_cell to mapped_device Jun'ichi Nomura

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=441A018A.7070301@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.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.