If a server doesn't provide a service the port lookup will return 0. Check for this, return an appropriate error code and give a hint as to why this might be happening. This was tested by running NFS with UDP disabled, which seems to be the default in Arch at least. Signed-off-by: John Watts <contact@xxxxxxxxxx> --- Changes v1 -> v2: - Added error message --- fs/nfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/nfs.c b/fs/nfs.c index 446d0f7946..1a0b28442d 100644 --- a/fs/nfs.c +++ b/fs/nfs.c @@ -571,6 +571,12 @@ static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver) nfs_free_packet(nfs_packet); + if (port == 0) { + pr_warn("No UDP port for RPC program %i! " + "Is your NFS server TCP only?\n", prog); + return -ENOENT; + } + return port; } -- 2.39.1