Hello Sascha, On Mon, Nov 02, 2020 at 10:14:29AM +0100, Sascha Hauer wrote: > 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 > > --- > > 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? When I started this function I wasn't aware that this is a real 1:1 mapping (i.e. s/NFSERR_/E/) and I considered it useful that the error name (as it appears in the NFS3-RFC) is part of the error message. With some distance to this patch just skipping the errorname part looks fine for me. I will rework that. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |