aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osd_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-18 17:52:18 -0500
committerSage Weil <sage@newdream.net>2009-11-18 18:02:36 -0500
commit5f44f142601bf94c448e2d463f0f18fd159da164 (patch)
tree773b4677c536519435f073b27873212f705c9c3c /fs/ceph/osd_client.c
parent71ececdacae24be333c534869cb1b06357f0e215 (diff)
ceph: handle errors during osd client init
Unwind initializing if we get ENOMEM during client initialization. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osd_client.c')
-rw-r--r--fs/ceph/osd_client.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index bcb9fe693076..0a16c4f951f9 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -1127,19 +1127,26 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
1127 osdc->num_requests = 0; 1127 osdc->num_requests = 0;
1128 INIT_DELAYED_WORK(&osdc->timeout_work, handle_timeout); 1128 INIT_DELAYED_WORK(&osdc->timeout_work, handle_timeout);
1129 1129
1130 err = -ENOMEM;
1130 osdc->req_mempool = mempool_create_kmalloc_pool(10, 1131 osdc->req_mempool = mempool_create_kmalloc_pool(10,
1131 sizeof(struct ceph_osd_request)); 1132 sizeof(struct ceph_osd_request));
1132 if (!osdc->req_mempool) 1133 if (!osdc->req_mempool)
1133 return -ENOMEM; 1134 goto out;
1134 1135
1135 err = ceph_msgpool_init(&osdc->msgpool_op, 4096, 10, true); 1136 err = ceph_msgpool_init(&osdc->msgpool_op, 4096, 10, true);
1136 if (err < 0) 1137 if (err < 0)
1137 return -ENOMEM; 1138 goto out_mempool;
1138 err = ceph_msgpool_init(&osdc->msgpool_op_reply, 512, 0, false); 1139 err = ceph_msgpool_init(&osdc->msgpool_op_reply, 512, 0, false);
1139 if (err < 0) 1140 if (err < 0)
1140 return -ENOMEM; 1141 goto out_msgpool;
1141
1142 return 0; 1142 return 0;
1143
1144out_msgpool:
1145 ceph_msgpool_destroy(&osdc->msgpool_op);
1146out_mempool:
1147 mempool_destroy(osdc->req_mempool);
1148out:
1149 return err;
1143} 1150}
1144 1151
1145void ceph_osdc_stop(struct ceph_osd_client *osdc) 1152void ceph_osdc_stop(struct ceph_osd_client *osdc)