summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2019-04-26 14:58:33 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-04-29 09:03:29 +0200
commit3a9ea929d89cacd14bbdf73a031d1eaf23abecdc (patch)
treefea4e3314ce252a12d7d1212cb906da185eb833a
parent17ab16933959bf8722c6cb353f31fc06926e2ad4 (diff)
downloadbarebox-3a9ea929d89cacd14bbdf73a031d1eaf23abecdc.tar.gz
barebox-3a9ea929d89cacd14bbdf73a031d1eaf23abecdc.tar.xz
fs: nfs: ensure rpc_req message is send
Currently we send a rpc message without checking if the send was succesful and poll for a answer from the server. If the server didn't answer within the NFS_TIMEOUT window we send the package again. In case the package send wasn't successful we always run in that timeout. This gets even worse if the package send fails more than one time. Check if the package send was successful and resend the package if it wasn't to fix this behaviour. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/nfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 574fb85fb6..d606ccd1e9 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -436,9 +436,20 @@ static struct packet *rpc_req(struct nfs_priv *npriv, int rpc_prog,
npriv->con->udp->uh_dport = hton16(dport);
+ nfs_timer_start = get_time_ns();
+
again:
ret = net_udp_send(npriv->con,
sizeof(pkt) + datalen * sizeof(uint32_t));
+ if (ret) {
+ if (is_timeout(nfs_timer_start, NFS_TIMEOUT)) {
+ tries++;
+ if (tries == NFS_MAX_RESEND)
+ return ERR_PTR(-ETIMEDOUT);
+ }
+
+ goto again;
+ }
nfs_timer_start = get_time_ns();