* [PATCH] fs: nfs: ensure rpc_req message is send
@ 2019-04-26 12:58 Marco Felsch
2019-04-29 7:02 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Marco Felsch @ 2019-04-26 12:58 UTC (permalink / raw)
To: barebox; +Cc: mfe
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: nfs: ensure rpc_req message is send
2019-04-26 12:58 [PATCH] fs: nfs: ensure rpc_req message is send Marco Felsch
@ 2019-04-29 7:02 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-04-29 7:02 UTC (permalink / raw)
To: Marco Felsch; +Cc: barebox, mfe
On Fri, Apr 26, 2019 at 02:58:33PM +0200, Marco Felsch wrote:
> 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(+)
Applied, thanks
Sascha
>
> 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
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-29 7:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 12:58 [PATCH] fs: nfs: ensure rpc_req message is send Marco Felsch
2019-04-29 7:02 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox