mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] nfs: check return value of various rpc calls
Date: Mon, 2 Nov 2020 14:56:39 +0100	[thread overview]
Message-ID: <20201102135639.czd5xxxwqjr3sdkx@pengutronix.de> (raw)
In-Reply-To: <20201102091429.GU26805@pengutronix.de>


[-- Attachment #1.1: Type: text/plain, Size: 2040 bytes --]

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 <u.kleine-koenig@pengutronix.de>
> > ---
> >  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/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

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

      reply	other threads:[~2020-11-02 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 11:36 Uwe Kleine-König
2020-11-02  9:14 ` Sascha Hauer
2020-11-02 13:56   ` Uwe Kleine-König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102135639.czd5xxxwqjr3sdkx@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox