From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 2/3] rbd: don't revalidate so much
Date: Tue, 30 Apr 2013 07:23:35 -0500 [thread overview]
Message-ID: <517FB7C7.90900@inktank.com> (raw)
In-Reply-To: <517FB770.1070500@inktank.com>
Whenever a header object event causes a mapped rbd image to refresh
its header information, revalidate_disk() is being called. This was
done in rbd_dev_refresh() outside the control mutex in order to
avoid a lock inversion. Although a an event like this *might*
indicate the image has changed size, most of the time it does not.
Record the image size before and after the refresh, and only
call revalidate_disk() if it changes.
This resolves:
http://tracker.ceph.com/issues/4867
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 176a3d7..dbc61e3 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3065,19 +3065,22 @@ static int rbd_dev_v1_refresh(struct rbd_device
*rbd_dev, u64 *hver)
static int rbd_dev_refresh(struct rbd_device *rbd_dev, u64 *hver)
{
+ u64 image_size;
int ret;
rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
+ image_size = rbd_dev->header.image_size;
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
if (rbd_dev->image_format == 1)
ret = rbd_dev_v1_refresh(rbd_dev, hver);
else
ret = rbd_dev_v2_refresh(rbd_dev, hver);
mutex_unlock(&ctl_mutex);
- revalidate_disk(rbd_dev->disk);
if (ret)
rbd_warn(rbd_dev, "got notification but failed to "
" update snaps: %d\n", ret);
+ if (image_size != rbd_dev->header.image_size)
+ revalidate_disk(rbd_dev->disk);
return ret;
}
--
1.7.9.5
next prev parent reply other threads:[~2013-04-30 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 12:22 [PATCH 0/3] rbd: a few small issues Alex Elder
2013-04-30 12:23 ` [PATCH 1/3] rbd: fix up the layering warning message Alex Elder
2013-04-30 12:23 ` Alex Elder [this message]
2013-04-30 12:23 ` [PATCH 3/3] rbd: snap names are pointer to constant data Alex Elder
2013-04-30 18:32 ` [PATCH 0/3] rbd: a few small issues Josh Durgin
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=517FB7C7.90900@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 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.