From 6fb3b7aa317a6429daf86b140785875a70686bac Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 7 Jul 2012 14:11:23 -0400 Subject: [PATCH] Windows: not all short rx_Read[v] reads are fatal When performing a RXAFS_FetchData[64] RPC, a short read from rx_Read[v] is not a reason to stop processing the call unless it is the first read and the file server FetchData offset bug has been detected. If not, only stop processing if the rx_Read[v] return value is <= 0. Change-Id: I5b10ce7903686fa3d9c251e6c92c4bcec376ed40 Reviewed-on: http://gerrit.openafs.org/7749 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_dcache.c | 40 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index dd156cbbea..040671aae7 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -1987,11 +1987,13 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp * length_found and continue as if the file server said * it was sending us zero octets of data. */ - if (fs_fetchdata_offset_bug && first_read) + if (fs_fetchdata_offset_bug && first_read) { length_found = 0; - else + break; + } else if (temp <= 0) { code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR; - break; + break; + } } iov = 0; @@ -2064,11 +2066,13 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp * length_found and continue as if the file server said * it was sending us zero octets of data. */ - if (fs_fetchdata_offset_bug && first_read) + if (fs_fetchdata_offset_bug && first_read) { length_found = 0; - else + break; + } else if (temp <= 0) { code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR; - break; + break; + } } first_read = 0; @@ -2436,11 +2440,13 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le * length_found and continue as if the file server said * it was sending us zero octets of data. */ - if (fs_fetchdata_offset_bug && first_read) + if (fs_fetchdata_offset_bug && first_read) { length_found = 0; - else + break; + } else if (temp <= 0) { code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR; - break; + break; + } } iov = 0; @@ -2483,11 +2489,13 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le * length_found and continue as if the file server said * it was sending us zero octets of data. */ - if (fs_fetchdata_offset_bug && first_read) + if (fs_fetchdata_offset_bug && first_read) { length_found = 0; - else + break; + } else if (temp <= 0) { code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR; - break; + break; + } } first_read = 0; @@ -2726,11 +2734,13 @@ cm_VerifyStoreData(cm_bulkIO_t *biod, cm_scache_t *savedScp) * length_found and continue as if the file server said * it was sending us zero octets of data. */ - if (fs_fetchdata_offset_bug && first_read) + if (fs_fetchdata_offset_bug && first_read) { length_found = 0; - else + break; + } else if (temp <= 0) { code = (rx_Error(rxcallp) < 0) ? rx_Error(rxcallp) : RX_PROTOCOL_ERROR; - break; + break; + } } first_read = 0;