libceph: fix ceph_osdc_alloc_request error checks
authorSage Weil <sage@newdream.net>
Tue, 3 May 2011 16:23:36 +0000 (09:23 -0700)
committerSage Weil <sage@newdream.net>
Tue, 3 May 2011 16:28:13 +0000 (09:28 -0700)
ceph_osdc_alloc_request returns NULL on failure.

Signed-off-by: Sage Weil <sage@newdream.net>
drivers/block/rbd.c
net/ceph/osd_client.c

index 16dc3645291cd7bbb3eab203b83dde68939b61d7..3e904717c1c05f4dee56e040f9bf7df2faf57ce1 100644 (file)
@@ -777,9 +777,9 @@ static int rbd_do_request(struct request *rq,
                                      ops,
                                      false,
                                      GFP_NOIO, pages, bio);
-       if (IS_ERR(req)) {
+       if (!req) {
                up_read(&header->snap_rwsem);
-               ret = PTR_ERR(req);
+               ret = -ENOMEM;
                goto done_pages;
        }
 
index 5a80f41c0cbaf207cf71310161856b5a31e65b4a..6b5dda1cb5df1a7adf6b93a49201b34d81eb8dcb 100644 (file)
@@ -470,8 +470,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
                                         snapc, ops,
                                         use_mempool,
                                         GFP_NOFS, NULL, NULL);
-       if (IS_ERR(req))
-               return req;
+       if (!req)
+               return NULL;
 
        /* calculate max write size */
        calc_layout(osdc, vino, layout, off, plen, req, ops);