Whamcloud - gitweb
LU-14711 osc: Do not attempt sending empty pages 54/44654/3
authorOleg Drokin <green@whamcloud.com>
Wed, 28 Jul 2021 18:02:19 +0000 (14:02 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Oct 2021 16:55:43 +0000 (16:55 +0000)
Do not crash if trying to send a lock-prolonging emtpy read
to an old server, if the server does not support short reads.
Otherwise the client crashes when access the NULL page.

Test-Parameters: trivial
Fixes: 564070343ac4 ("LU-14711 osc: Notify server if cache discard takes a long time")
Change-Id: Icae7bf3ef16c45d33894b3c5fbac15b1a98c39d9
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44654
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
lustre/osc/osc_request.c

index b80f8f4..4ca9be0 100644 (file)
@@ -1557,6 +1557,12 @@ retry_encrypt:
            !imp_connect_shortio(cli->cl_import))
                short_io_size = 0;
 
            !imp_connect_shortio(cli->cl_import))
                short_io_size = 0;
 
+       /* If this is an empty RPC to old server, just ignore it */
+       if (!short_io_size && !pga[0]->pg) {
+               ptlrpc_request_free(req);
+               RETURN(-ENODATA);
+       }
+
        req_capsule_set_size(pill, &RMF_SHORT_IO, RCL_CLIENT,
                             opc == OST_READ ? 0 : short_io_size);
        if (opc == OST_READ)
        req_capsule_set_size(pill, &RMF_SHORT_IO, RCL_CLIENT,
                             opc == OST_READ ? 0 : short_io_size);
        if (opc == OST_READ)