aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-09-25 00:01:02 -0400
committerAlex Elder <elder@inktank.com>2012-10-01 18:20:00 -0400
commit6816282dab3a72efe8c0d182c1bc2960d87f4322 (patch)
treec36cea753185ad22b073d41a1e5e5dbe56a928a1 /net
parentd63b77f4c552cc3a20506871046ab0fcbc332609 (diff)
ceph: propagate layout error on osd request creation
If we are creating an osd request and get an invalid layout, return an EINVAL to the caller. We switch up the return to have an error code instead of NULL implying -ENOMEM. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osd_client.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index f7b56e23988c..ccbdfbba9e53 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -464,6 +464,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
464{ 464{
465 struct ceph_osd_req_op ops[3]; 465 struct ceph_osd_req_op ops[3];
466 struct ceph_osd_request *req; 466 struct ceph_osd_request *req;
467 int r;
467 468
468 ops[0].op = opcode; 469 ops[0].op = opcode;
469 ops[0].extent.truncate_seq = truncate_seq; 470 ops[0].extent.truncate_seq = truncate_seq;
@@ -482,10 +483,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
482 use_mempool, 483 use_mempool,
483 GFP_NOFS, NULL, NULL); 484 GFP_NOFS, NULL, NULL);
484 if (!req) 485 if (!req)
485 return NULL; 486 return ERR_PTR(-ENOMEM);
486 487
487 /* calculate max write size */ 488 /* calculate max write size */
488 calc_layout(osdc, vino, layout, off, plen, req, ops); 489 r = calc_layout(osdc, vino, layout, off, plen, req, ops);
490 if (r < 0)
491 return ERR_PTR(r);
489 req->r_file_layout = *layout; /* keep a copy */ 492 req->r_file_layout = *layout; /* keep a copy */
490 493
491 /* in case it differs from natural (file) alignment that 494 /* in case it differs from natural (file) alignment that
@@ -1928,8 +1931,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
1928 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, 1931 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
1929 NULL, 0, truncate_seq, truncate_size, NULL, 1932 NULL, 0, truncate_seq, truncate_size, NULL,
1930 false, 1, page_align); 1933 false, 1, page_align);
1931 if (!req) 1934 if (IS_ERR(req))
1932 return -ENOMEM; 1935 return PTR_ERR(req);
1933 1936
1934 /* it may be a short read due to an object boundary */ 1937 /* it may be a short read due to an object boundary */
1935 req->r_pages = pages; 1938 req->r_pages = pages;
@@ -1971,8 +1974,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
1971 snapc, do_sync, 1974 snapc, do_sync,
1972 truncate_seq, truncate_size, mtime, 1975 truncate_seq, truncate_size, mtime,
1973 nofail, 1, page_align); 1976 nofail, 1, page_align);
1974 if (!req) 1977 if (IS_ERR(req))
1975 return -ENOMEM; 1978 return PTR_ERR(req);
1976 1979
1977 /* it may be a short write due to an object boundary */ 1980 /* it may be a short write due to an object boundary */
1978 req->r_pages = pages; 1981 req->r_pages = pages;