[lustre-devel] [PATCH 211/622] lustre: lov: fix lov_iocontrol for inactive OST case

James Simmons jsimmons at infradead.org
Thu Feb 27 13:11:19 PST 2020


From: Vladimir Saveliev <c17830 at cray.com>

For inactive OSTs lov->lov_tgts[index]->ltd_exp is
NULL. lov_iocontrol() is to check that before dereferencing to
lov->lov_tgts[index]->ltd_exp->exp_obd.

WC-bug-id: https://jira.whamcloud.com/browse/LU-11911
Lustre-commit: 0facd12afa33 ("LU-11911 lov: fix lov_iocontrol for inactive OST case")
Signed-off-by: Vladimir Saveliev <c17830 at cray.com>
Cray-bug-id: LUS-6937
Reviewed-on: https://review.whamcloud.com/34148
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Alexandr Boyko <c17825 at cray.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/lov/lov_obd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/lustre/lov/lov_obd.c b/fs/lustre/lov/lov_obd.c
index 08d7edc..cc0ca1c 100644
--- a/fs/lustre/lov/lov_obd.c
+++ b/fs/lustre/lov/lov_obd.c
@@ -1001,15 +1001,15 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 			/* Try again with the next index */
 			return -EAGAIN;
 
-		imp = lov->lov_tgts[index]->ltd_exp->exp_obd->u.cli.cl_import;
-		if (!lov->lov_tgts[index]->ltd_active &&
-		    imp->imp_state != LUSTRE_IMP_IDLE)
-			return -ENODATA;
-
 		osc_obd = class_exp2obd(lov->lov_tgts[index]->ltd_exp);
 		if (!osc_obd)
 			return -EINVAL;
 
+		imp = osc_obd->u.cli.cl_import;
+		if (!lov->lov_tgts[index]->ltd_active &&
+		    imp->imp_state != LUSTRE_IMP_IDLE)
+			return -ENODATA;
+
 		/* copy UUID */
 		if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
 				 min_t(unsigned long, data->ioc_plen2,
-- 
1.8.3.1



More information about the lustre-devel mailing list