From 10d148abe23d215c818643a0fea24c5d121046f0 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 9 Apr 2015 21:26:25 -0500 Subject: [PATCH] afs: Log weird 'size' fetchdata errors There are a couple of situations that should never happen when issuing a fetchdata, but cause errors when they do: - The fileserver responds with more than 2^32 bytes of data - The fileserver responds with more data than requested (but still smaller than 2^32) While these should normally never be encountered, it can be very confusing when they do, since they cause file fetches to fail. To give the user or investigating developer some hope of figuring out what is going on, at least log a warning in these situations, to at least indicate this is the area in which something is breaking. Only log these once, in case something causes these conditions to be hit, e.g., every fetch. Once is at least enough to say this is happening. [mmeffie@sinenomine.net remove unneeded casts in afs_warn args and explicit static initializers.] Reviewed-on: http://gerrit.openafs.org/11830 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 5fbf45b56298aa5a93cf9015f2d6346c7a0f615c) Change-Id: I2f15255f33f44bef038ac9926d1ed47eca73d89a Reviewed-on: https://gerrit.openafs.org/12215 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- src/afs/afs_fetchstore.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index 9d8c2ac8b..f49467732 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -990,6 +990,14 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn, * in a signed 32-bit integer. If it is, we can't handle that, so * error out. */ if (length64 > MAX_AFS_INT32) { + static int warned; + if (!warned) { + warned = 1; + afs_warn("afs: Warning: FetchData64 returned too much data " + "(length64 %u.%u); this should not happen! " + "Aborting fetch request.\n", + length_hi, length); + } RX_AFS_GUNLOCK(); code = rx_EndCall(v->call, RX_PROTOCOL_ERROR); v->call = NULL; @@ -1054,6 +1062,14 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn, * requested. It shouldn't do that, and accepting that much data * can make us take up more cache space than we're supposed to, * so error. */ + static int warned; + if (!warned) { + warned = 1; + afs_warn("afs: Warning: FetchData64 returned more data than " + "requested (requested %ld, got %ld); this should not " + "happen! Aborting fetch request.\n", + (long)size, (long)*alength); + } code = rx_Error(v->call); RX_AFS_GUNLOCK(); code1 = rx_EndCall(v->call, code); -- 2.39.5