From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 1/4] rbd: move locking out of rbd_header_set_snap()
Date: Fri, 07 Sep 2012 09:50:12 -0500 [thread overview]
Message-ID: <504A09A4.7050404@inktank.com> (raw)
In-Reply-To: <504A090F.7000706@inktank.com>
Move the calls to get the header semaphore out of
rbd_header_set_snap() and into its caller.
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 634a16c..214c937 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -647,8 +647,6 @@ static int rbd_header_set_snap(struct rbd_device
*rbd_dev, char *snap_name)
{
int ret;
- down_write(&rbd_dev->header_rwsem);
-
if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME,
sizeof (RBD_SNAP_HEAD_NAME))) {
rbd_dev->mapping.snap_id = CEPH_NOSNAP;
@@ -666,7 +664,6 @@ static int rbd_header_set_snap(struct rbd_device
*rbd_dev, char *snap_name)
ret = 0;
done:
- up_write(&rbd_dev->header_rwsem);
return ret;
}
@@ -2608,7 +2605,9 @@ static ssize_t rbd_add(struct bus_type *bus,
if (rc)
goto err_out_bus;
+ down_write(&rbd_dev->header_rwsem);
rc = rbd_header_set_snap(rbd_dev, snap_name);
+ up_write(&rbd_dev->header_rwsem);
if (rc)
goto err_out_bus;
--
1.7.9.5
next prev parent reply other threads:[~2012-09-07 14:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 14:47 [PATCH 0/4] rbd: locking, snapshot registration, snap_by_name() Alex Elder
2012-09-07 14:50 ` Alex Elder [this message]
2012-09-10 21:57 ` [PATCH 1/4] rbd: move locking out of rbd_header_set_snap() Josh Durgin
2012-09-07 14:50 ` [PATCH 2/4] rbd: expand lock protection in rbd_add() Alex Elder
2012-09-10 22:05 ` Josh Durgin
2012-09-11 13:52 ` Alex Elder
2012-09-11 14:33 ` Josh Durgin
2012-09-07 14:50 ` [PATCH 3/4] rbd: don't register snapshots in bus_add_dev() Alex Elder
2012-09-10 22:21 ` Josh Durgin
2012-09-07 14:50 ` [PATCH 4/4] rbd: use snaps list in rbd_snap_by_name() Alex Elder
2012-09-10 22:32 ` Josh Durgin
2012-09-11 14:05 ` Alex Elder
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=504A09A4.7050404@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox