[U-Boot] [PATCH 3/4] nfs: handle rpc errors for mount calls

Christian Gmeiner christian.gmeiner at gmail.com
Mon Oct 1 09:46:45 UTC 2018


From: Thomas RIENOESSL <thomas.rienoessl at bachmann.info>

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl at bachmann.info>
---
 net/nfs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/nfs.c b/net/nfs.c
index d3de9b8c38..bd6588fe42 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -531,11 +531,9 @@ static int nfs_mount_reply(uchar *pkt, unsigned len)
 	else if (ntohl(rpc_pkt.u.reply.id) < rpc_id)
 		return -NFS_RPC_DROP;
 
-	if (rpc_pkt.u.reply.rstatus  ||
-	    rpc_pkt.u.reply.verifier ||
-	    rpc_pkt.u.reply.astatus  ||
-	    rpc_pkt.u.reply.data[0])
-		return -1;
+	int ret =  rpc_handle_error(&rpc_pkt);
+	if (ret)
+		return ret;
 
 	fs_mounted = 1;
 	/*  NFSv2 and NFSv3 use same structure */
@@ -779,6 +777,10 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			/* just to be sure... */
 			nfs_state = STATE_UMOUNT_REQ;
 			nfs_send();
+		} else if (reply == -NFS_RPC_PROG_MISMATCH &&
+			   choosen_nfs_version != NFS_UNKOWN) {
+			nfs_state = STATE_MOUNT_REQ;
+			nfs_send();
 		} else {
 			nfs_state = STATE_LOOKUP_REQ;
 			nfs_send();
-- 
2.17.1



More information about the U-Boot mailing list