diff mbox series

[10/20] lustre: osc: Do not attempt sending empty pages

Message ID 1633974049-26490-11-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS Oct 11, 2021 | expand

Commit Message

James Simmons Oct. 11, 2021, 5:40 p.m. UTC
From: Oleg Drokin <green@whamcloud.com>

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.

Fixes: 1febc3615e2b ("lustre: osc: Notify server if cache discard takes a long time")
WC-bug-id: https://jira.whamcloud.com/browse/LU-14711
Lustre-commit: 1a409a3e6a7468597 ("LU-14711 osc: Do not attempt sending empty pages")
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44654
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/osc/osc_request.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index def2ee7..e5b7453 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -1567,6 +1567,12 @@  static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 	    !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)