diff options
author | Alex Elder <elder@inktank.com> | 2013-01-25 18:08:55 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-13 21:29:10 -0500 |
commit | 25dcf954c3230946b5f3e18db9f91d7640eff76e (patch) | |
tree | cc7e5d7f69c3ab1dd49deea447fb697675bff5a3 /drivers/block | |
parent | 975241afcbba82ab1ddc6ebf8a02246d1e9314fd (diff) |
rbd: decrement obj request count when deleting
Decrement the obj_request_count value when deleting an object
request from its image request's list. Rearrange a few lines
in the surrounding code.
This resolves:
http://tracker.ceph.com/issues/3940
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index fc1a045cee4d..d3d15d06abc0 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1063,22 +1063,29 @@ static void rbd_img_request_put(struct rbd_img_request *img_request) | |||
1063 | static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, | 1063 | static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, |
1064 | struct rbd_obj_request *obj_request) | 1064 | struct rbd_obj_request *obj_request) |
1065 | { | 1065 | { |
1066 | rbd_assert(obj_request->img_request == NULL); | ||
1067 | |||
1066 | rbd_obj_request_get(obj_request); | 1068 | rbd_obj_request_get(obj_request); |
1067 | obj_request->img_request = img_request; | 1069 | obj_request->img_request = img_request; |
1068 | list_add_tail(&obj_request->links, &img_request->obj_requests); | 1070 | obj_request->which = img_request->obj_request_count; |
1069 | obj_request->which = img_request->obj_request_count++; | ||
1070 | rbd_assert(obj_request->which != BAD_WHICH); | 1071 | rbd_assert(obj_request->which != BAD_WHICH); |
1072 | img_request->obj_request_count++; | ||
1073 | list_add_tail(&obj_request->links, &img_request->obj_requests); | ||
1071 | } | 1074 | } |
1072 | 1075 | ||
1073 | static inline void rbd_img_obj_request_del(struct rbd_img_request *img_request, | 1076 | static inline void rbd_img_obj_request_del(struct rbd_img_request *img_request, |
1074 | struct rbd_obj_request *obj_request) | 1077 | struct rbd_obj_request *obj_request) |
1075 | { | 1078 | { |
1076 | rbd_assert(obj_request->which != BAD_WHICH); | 1079 | rbd_assert(obj_request->which != BAD_WHICH); |
1077 | obj_request->which = BAD_WHICH; | 1080 | |
1078 | list_del(&obj_request->links); | 1081 | list_del(&obj_request->links); |
1082 | rbd_assert(img_request->obj_request_count > 0); | ||
1083 | img_request->obj_request_count--; | ||
1084 | rbd_assert(obj_request->which == img_request->obj_request_count); | ||
1085 | obj_request->which = BAD_WHICH; | ||
1079 | rbd_assert(obj_request->img_request == img_request); | 1086 | rbd_assert(obj_request->img_request == img_request); |
1080 | obj_request->callback = NULL; | ||
1081 | obj_request->img_request = NULL; | 1087 | obj_request->img_request = NULL; |
1088 | obj_request->callback = NULL; | ||
1082 | rbd_obj_request_put(obj_request); | 1089 | rbd_obj_request_put(obj_request); |
1083 | } | 1090 | } |
1084 | 1091 | ||
@@ -1472,6 +1479,7 @@ static void rbd_img_request_destroy(struct kref *kref) | |||
1472 | 1479 | ||
1473 | for_each_obj_request_safe(img_request, obj_request, next_obj_request) | 1480 | for_each_obj_request_safe(img_request, obj_request, next_obj_request) |
1474 | rbd_img_obj_request_del(img_request, obj_request); | 1481 | rbd_img_obj_request_del(img_request, obj_request); |
1482 | rbd_assert(img_request->obj_request_count == 0); | ||
1475 | 1483 | ||
1476 | if (img_request->write_request) | 1484 | if (img_request->write_request) |
1477 | ceph_put_snap_context(img_request->snapc); | 1485 | ceph_put_snap_context(img_request->snapc); |