Pull ceph fix from Sage Weil: "This fixes a regression introduced during the last merge window when mapping non-existent images." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: rbd: don't zero-fill non-image object requests
Unified · Split
| @@ -1264,6 +1264,32 @@ static bool obj_request_done_test(struct rbd_obj_request *obj_request) · 1263 unmodified lines | ||
| 1264 | 1264 | return atomic_read(&obj_request->done) != 0; |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | +static void | |
| 1268 | +rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request) | |
| 1269 | +{ | |
| 1270 | + dout("%s: obj %p img %p result %d %llu/%llu\n", __func__, | |
| 1271 | + obj_request, obj_request->img_request, obj_request->result, | |
| 1272 | + obj_request->xferred, obj_request->length); | |
| 1273 | + /* | |
| 1274 | + * ENOENT means a hole in the image. We zero-fill the | |
| 1275 | + * entire length of the request. A short read also implies | |
| 1276 | + * zero-fill to the end of the request. Either way we | |
| 1277 | + * update the xferred count to indicate the whole request | |
| 1278 | + * was satisfied. | |
| 1279 | + */ | |
| 1280 | + BUG_ON(obj_request->type != OBJ_REQUEST_BIO); | |
| 1281 | + if (obj_request->result == -ENOENT) { | |
| 1282 | + zero_bio_chain(obj_request->bio_list, 0); | |
| 1283 | + obj_request->result = 0; | |
| 1284 | + obj_request->xferred = obj_request->length; | |
| 1285 | + } else if (obj_request->xferred < obj_request->length && | |
| 1286 | + !obj_request->result) { | |
| 1287 | + zero_bio_chain(obj_request->bio_list, obj_request->xferred); | |
| 1288 | + obj_request->xferred = obj_request->length; | |
| 1289 | + } | |
| 1290 | + obj_request_done_set(obj_request); | |
| 1291 | +} | |
| 1292 | + | |
| 1267 | 1293 | static void rbd_obj_request_complete(struct rbd_obj_request *obj_request) |
| 1268 | 1294 | { |
| 1269 | 1295 | dout("%s: obj %p cb %p\n", __func__, obj_request, |
| @@ -1284,23 +1310,10 @@ static void rbd_osd_read_callback(struct rbd_obj_request *obj_request) · 14 unmodified lines | ||
| 1284 | 1310 | { |
| 1285 | 1311 | dout("%s: obj %p result %d %llu/%llu\n", __func__, obj_request, |
| 1286 | 1312 | obj_request->result, obj_request->xferred, obj_request->length); |
| 1287 | − /* | |
| 1288 | − * ENOENT means a hole in the object. We zero-fill the | |
| 1289 | − * entire length of the request. A short read also implies | |
| 1290 | − * zero-fill to the end of the request. Either way we | |
| 1291 | − * update the xferred count to indicate the whole request | |
| 1292 | − * was satisfied. | |
| 1293 | − */ | |
| 1294 | − if (obj_request->result == -ENOENT) { | |
| 1295 | − zero_bio_chain(obj_request->bio_list, 0); | |
| 1296 | − obj_request->result = 0; | |
| 1297 | − obj_request->xferred = obj_request->length; | |
| 1298 | − } else if (obj_request->xferred < obj_request->length && | |
| 1299 | − !obj_request->result) { | |
| 1300 | − zero_bio_chain(obj_request->bio_list, obj_request->xferred); | |
| 1301 | − obj_request->xferred = obj_request->length; | |
| 1302 | − } | |
| 1303 | − obj_request_done_set(obj_request); | |
| 1313 | + if (obj_request->img_request) | |
| 1314 | + rbd_img_obj_request_read_callback(obj_request); | |
| 1315 | + else | |
| 1316 | + obj_request_done_set(obj_request); | |
| 1304 | 1317 | } |
| 1305 | 1318 | |
| 1306 | 1319 | static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) |