fs: nfs: Error if a port is unregistered
PATCH 1/1 fs: nfs: Error if a port is unregistered
If a server doesn't provide a service the port lookup will return 0. Check for this and return an appropriate error code.
This was tested by running NFS with UDP disabled, which seems to be the default in Arch at least.
--- fs/nfs.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfs.c +3 -0
@@ -571,6 +571,9 @@ static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver)nfs_free_packet (nfs_packet); +if (port ==0 ) +return -ENOENT ; +return port; }
Signature · 1 line
2.39.1
Quoted 16 lines · John Watts
If a server doesn't provide a service the port lookup will return 0. Check for this and return an appropriate error code.
This was tested by running NFS with UDP disabled, which seems to be the default in Arch at least.
Signed-off-by John Watts <[email protected]>--- fs/nfs.c | 3 +++ 1 file changed, 3 insertions(+)fs/nfs.c +0
-0
fs/nfs.c static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver) · line 576
Quoted 6 lines
fs/nfs.c +3
-0@@ -571,6 +571,9 @@ static int rpc_lookup_req(struct nfs_priv *npriv, uint32_t prog, uint32_t ver)nfs_free_packet (nfs_packet); +if (port ==0 ) +return -ENOENT ; +
When this happens do we see a meaningful error message on the barebox side? From a feeling I would say -ECONNREFUSED might be a better error code, but I don't know if that's suitable for UDP connections.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 3 lines · Sascha Hauer
When this happens do we see a meaningful error message on the barebox side? From a feeling I would say
-ECONNREFUSEDmight be a better error code, but I don't know if that's suitable for UDP connections.
Currently the error looks like this:
mounting failed with -110
ERROR: nfs nfs0: probe failed: Connection timed out
mount: Invalid argument
probe-> nfs0
lookup mount port failed with -110
ERROR: nfs nfs0: probe failed: Connection timed out
Now it looks like:
lookup mount port failed with -2
ERROR: nfs nfs0: probe failed: No such file or directory
mount: Invalid argument
probe-> nfs0
Not sure how this could be improved.
Quoted 1 line
Sascha
John.
Quoted 14 lines · Jookia
Quoted 3 lines · Sascha Hauer
When this happens do we see a meaningful error message on the barebox side? From a feeling I would say
-ECONNREFUSEDmight be a better error code, but I don't know if that's suitable for UDP connections.Currently the error looks like this:
mounting failed with -110
ERROR: nfs nfs0: probe failed: Connection timed out
mount: Invalid argumentprobe-> nfs0lookup mount port failed with -110
ERROR: nfs nfs0: probe failed: Connection timed out
Quoted 8 lines
Now it looks like:
lookup mount port failed with -2
ERROR: nfs nfs0: probe failed: No such file or directory
mount: Invalid argumentprobe-> nfs0Not sure how this could be improved.
Add a pr_warn with a descriptive message?
Quoted 6 lines
Quoted 2 lines
Sascha
John.
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 1 line · Ahmad Fatoum
Add a
pr_warnwith a descriptive message?
Something like "hint: check your nfs server supports UDP"?
John.
Quoted 4 lines · John Watts
Quoted 1 line · Ahmad Fatoum
Add a
pr_warnwith a descriptive message?Something like "hint: check your nfs server supports UDP"?
Or maybe: "No UDP port announced. Is the NFS server TCP-only?"
Cheers,
Ahmad
Quoted 3 lines
John.
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v2 1/1 fs: nfs: Error if a port is unregistered
In reply to John WattsIf 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.
---
Changes v1 -> v2:
- Added error message
--- fs/nfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/nfs.c +6 -0
@@ -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; }
Signature · 1 line
2.39.1
Sascha Hauer
AppliedQuoted 8 lines · John Watts
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.
Quoted 7 lines
Signed-off-by John Watts <[email protected]>---
Changes v1 -> v2:
- Added error message--- fs/nfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
Applied, thanks
Sascha
Quoted 23 lines
fs/nfs.c +6
-0@@ -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; }Signature · 1 line
2.39.1
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |