diff options
author | Alex Elder <elder@inktank.com> | 2013-04-30 00:44:32 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-01 21:20:11 -0700 |
commit | a3fbe5d447bf1f63efa7f4d8c222002ef136cf4b (patch) | |
tree | 1348d05858c4319f9b8fe9b5d73e983c13dcf52f /drivers | |
parent | 96882f55c40dcb4cd80b81a4374fdd297109ec98 (diff) | |
download | linux-a3fbe5d447bf1f63efa7f4d8c222002ef136cf4b.tar.gz linux-a3fbe5d447bf1f63efa7f4d8c222002ef136cf4b.tar.bz2 linux-a3fbe5d447bf1f63efa7f4d8c222002ef136cf4b.zip |
rbd: don't revalidate so much
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>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/rbd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 71e2de2cff22..ab2c788a22ad 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; } |