From: John L. Hammond Date: Tue, 8 Jul 2014 20:35:18 +0000 (-0500) Subject: LU-5290 clio: reorder initialization in cl_req_alloc() X-Git-Tag: 2.6.51~100 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=35c686077094fb92a1f15368e27d5f625c27c4f7;p=fs%2Flustre-release.git LU-5290 clio: reorder initialization in cl_req_alloc() In cl_req_alloc() ensure that the list heads crq_pages and crq_layers have been initialized before passing the request to cl_req_completion(). This fixes an oops in the error path. Signed-off-by: John L. Hammond Change-Id: I1f4ff994ca5db974e97b41452f7351f68ed350f8 Reviewed-on: http://review.whamcloud.com/11009 Tested-by: Jenkins Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index d0d2ac4..7825e08 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -1421,12 +1421,13 @@ struct cl_req *cl_req_alloc(const struct lu_env *env, struct cl_page *page, if (req != NULL) { int result; + req->crq_type = crt; + INIT_LIST_HEAD(&req->crq_pages); + INIT_LIST_HEAD(&req->crq_layers); + OBD_ALLOC(req->crq_o, nr_objects * sizeof req->crq_o[0]); if (req->crq_o != NULL) { req->crq_nrobjs = nr_objects; - req->crq_type = crt; - CFS_INIT_LIST_HEAD(&req->crq_pages); - CFS_INIT_LIST_HEAD(&req->crq_layers); result = cl_req_init(env, req, page); } else result = -ENOMEM;