rbd: BUG on invalid layout
authorSage Weil <sage@inktank.com>
Tue, 25 Sep 2012 04:02:47 +0000 (21:02 -0700)
committerAlex Elder <elder@inktank.com>
Mon, 1 Oct 2012 22:20:00 +0000 (17:20 -0500)
This shouldn't actually be possible because the layout struct is
constructed from the RBD header and validated then.

[elder@inktank.com: converted BUG() call to equivalent rbd_assert()]

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
drivers/block/rbd.c

index 2f1bef8c1d88a3557efd1b101ae1b86e5e088d70..bb3d9be3b1b4eecb82ba82f8bc1045e825ff7a75 100644 (file)
@@ -1020,8 +1020,9 @@ static int rbd_do_request(struct request *rq,
        layout->fl_stripe_count = cpu_to_le32(1);
        layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
        layout->fl_pg_pool = cpu_to_le32(rbd_dev->pool_id);
-       ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno,
-                               req, ops);
+       ret = ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno,
+                                  req, ops);
+       rbd_assert(ret == 0);
 
        ceph_osdc_build_request(req, ofs, &len,
                                ops,