From: Mikhail Pershin Date: Thu, 31 Oct 2019 20:44:38 +0000 (+0300) Subject: LU-12856 target: check FLFLAGS are valid while accessing them X-Git-Tag: 2.13.51~184 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=707f5a982e895c9a484dcdb8d1644e3f63c7c5cc;hp=e467a421c7aa175b9316f4ee78f392050d2f587f LU-12856 target: check FLFLAGS are valid while accessing them While checking OBD_FL_SHORT_IO flag check first that OBD_MD_FLFLAGS are valid. Signed-off-by: Mikhail Pershin Change-Id: I04ac61141d70883c29a113fac3985ac81cc878af Reviewed-on: https://review.whamcloud.com/36632 Reviewed-by: Patrick Farrell Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index e41c59c..f80a2c7 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -442,7 +442,8 @@ static int tgt_handle_request0(struct tgt_session_info *tsi, req_capsule_set_size(tsi->tsi_pill, &RMF_SHORT_IO, RCL_SERVER, - (body->oa.o_flags & OBD_FL_SHORT_IO) ? + (body->oa.o_valid & OBD_MD_FLFLAGS && + body->oa.o_flags & OBD_FL_SHORT_IO) ? remote_nb[0].rnb_len : 0); } @@ -2243,7 +2244,8 @@ int tgt_brw_read(struct tgt_session_info *tsi) if (rc != 0) GOTO(out_lock, rc); - if (body->oa.o_flags & OBD_FL_SHORT_IO) { + if (body->oa.o_valid & OBD_MD_FLFLAGS && + body->oa.o_flags & OBD_FL_SHORT_IO) { desc = NULL; } else { desc = ptlrpc_prep_bulk_exp(req, npages, ioobj_max_brw_get(ioo), @@ -2322,7 +2324,8 @@ int tgt_brw_read(struct tgt_session_info *tsi) /* Check if client was evicted while we were doing i/o before touching * network */ if (rc == 0) { - if (body->oa.o_flags & OBD_FL_SHORT_IO) { + if (body->oa.o_valid & OBD_MD_FLFLAGS && + body->oa.o_flags & OBD_FL_SHORT_IO) { unsigned char *short_io_buf; int short_io_size; @@ -2343,7 +2346,8 @@ int tgt_brw_read(struct tgt_session_info *tsi) } no_reply = rc != 0; } else { - if (body->oa.o_flags & OBD_FL_SHORT_IO) + if (body->oa.o_valid & OBD_MD_FLFLAGS && + body->oa.o_flags & OBD_FL_SHORT_IO) req_capsule_shrink(&req->rq_pill, &RMF_SHORT_IO, 0, RCL_SERVER); } @@ -2593,7 +2597,8 @@ int tgt_brw_write(struct tgt_session_info *tsi) objcount, ioo, remote_nb, &npages, local_nb); if (rc < 0) GOTO(out_lock, rc); - if (body->oa.o_flags & OBD_FL_SHORT_IO) { + if (body->oa.o_valid & OBD_MD_FLFLAGS && + body->oa.o_flags & OBD_FL_SHORT_IO) { unsigned int short_io_size; unsigned char *short_io_buf;