mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de
Subject: [PATCH] fs: nfs: ensure rpc_req message is send
Date: Fri, 26 Apr 2019 14:58:33 +0200	[thread overview]
Message-ID: <20190426125833.17367-1-m.felsch@pengutronix.de> (raw)

Currently we send a rpc message without checking if the send was
succesfull 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>
---
 fs/nfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

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();
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-04-26 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 12:58 Marco Felsch [this message]
2019-04-29  7:02 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190426125833.17367-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mfe@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox