Re: [PATCH] nfs: check return value of various rpc calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2020 at 12:36:14PM +0100, Uwe Kleine-König wrote:
> Check more carefully for failing requests. This improves the error
> message when trying to mount a non-exported nfs directory from:
> 
> 	nfs_mount_req: file handle too big: 44831
> 
> to
> 
> 	nfs_mount_req: Mounting gave error NFS3ERR_ACCES(0xd)
> 
> .
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
>  fs/nfs.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 81 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/nfs.c b/fs/nfs.c
> index 15ddab7915df..0be32322fb65 100644
> --- a/fs/nfs.c
> +++ b/fs/nfs.c
> @@ -636,13 +636,33 @@ static uint32_t *nfs_read_post_op_attr(uint32_t *p, struct inode *inode)
>  	return p;
>  }
>  
> +static int nfserror_to_err(u32 nfserror, const char **errorname)
> +{
> +#define E(NFSERR, ERR)			\
> +	case NFSERR:			\
> +		*errorname = #NFSERR;	\
> +		return -ERR
> +
> +	switch (nfserror) {
> +	E(NFS3_OK, 0);
> +	E(NFS3ERR_NOENT, ENOENT);
> +	E(NFS3ERR_IO, EIO);
> +	E(NFS3ERR_ACCES, EACCES);
> +	E(NFS3ERR_NOTDIR, ENOTDIR);
> +	E(NFS3ERR_NAMETOOLONG, ENAMETOOLONG);

You convert the NFS error codes to the corresponding error codes. For
these we already have strings, so why not just print them with %pe rather
than returning another string from this function?

Sascha

-- 
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 |

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




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux