rbd: BUG on invalid layout
authorSage Weil <sage@inktank.com>
Tue, 25 Sep 2012 04:02:47 +0000 (21:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:51:20 +0000 (08:51 -0800)
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>
(based on commit 6cae3717cddaf8e5e96e304733dca66e40d56f89)

drivers/block/rbd.c

index cf3ce69..f1375d9 100644 (file)
@@ -930,8 +930,9 @@ static int rbd_do_request(struct request *rq,
        layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
        layout->fl_pg_preferred = cpu_to_le32(-1);
        layout->fl_pg_pool = cpu_to_le32(dev->poolid);
-       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);
+       BUG_ON(ret != 0);
 
        ceph_osdc_build_request(req, ofs, &len,
                                ops,