Whamcloud - gitweb
LU-12856 target: check FLFLAGS are valid while accessing them 32/36632/2
authorMikhail Pershin <mpershin@whamcloud.com>
Thu, 31 Oct 2019 20:44:38 +0000 (23:44 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Dec 2019 00:57:20 +0000 (00:57 +0000)
While checking OBD_FL_SHORT_IO flag check first that OBD_MD_FLFLAGS
are valid.

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I04ac61141d70883c29a113fac3985ac81cc878af
Reviewed-on: https://review.whamcloud.com/36632
Reviewed-by: Patrick Farrell <farr0186@gmail.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/target/tgt_handler.c

index e41c59c..f80a2c7 100644 (file)
@@ -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;