From 847e98c42002f2b22c9b3b9624a44c327dee9050 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Wed, 20 Mar 2013 00:37:02 +0100 Subject: [PATCH] LU-2986 mdc: Kernel Oops on ioctl LL_IOC_GET_MDTIDX ll_get_mdt_idx() calls md_getattr() with a NULL 3rd parameter as a (struct ptlrpc_request **), this can lead to a SEGV if lmv is skipped, like for a single-MDS system without an LMV, and mdc_gettatr() is called straight. Signed-off-by: Bruno Faccini Change-Id: I0f9e5f6a4ae09c9e9a26b231d26b803418827c23 Reviewed-on: http://review.whamcloud.com/5769 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Ned Bass --- lustre/mdc/mdc_request.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 9f3dea4..f068026 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -225,6 +225,11 @@ int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, int rc; ENTRY; + /* Single MDS without an LMV case */ + if (op_data->op_flags & MF_GET_MDT_IDX) { + op_data->op_mds = 0; + RETURN(0); + } *request = NULL; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_GETATTR); if (req == NULL) -- 1.8.3.1