From: Carlos Maiolino <cmaiolino@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: fix xfs_error_get_cfg for negative errnos
Date: Tue, 19 Jul 2016 09:52:55 +0200 [thread overview]
Message-ID: <20160719075255.GB8134@redhat.com> (raw)
In-Reply-To: <9810c6bf-9fd7-bf41-13ab-a96bec861457@redhat.com>
On Fri, Jul 08, 2016 at 02:32:17PM -0500, Eric Sandeen wrote:
> xfs_error_get_cfg() is called with bp->b_error as an arg,
> which is negative, so the switch statement won't ever find
> any matches.
>
> This results in only the default error handler having
> any effect, as EIO/ENOSPC/ENODEV get ignored due to the
> wrong sign.
>
> It seems simplest to always flip the error sign to positive,
> so that we can handle either negative errors in bp->b_error,
> or possibly a positive errno via something like
> xfs_error_get_cfg(EIO) - this future-proofs the function.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This looks the right thing to do for me too.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>
> I'm still chasing down some odd behaviors in the error handling
> patches but this seems worth sending now :)
>
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index 4c2c550..79cfd3f 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -634,6 +634,9 @@ xfs_error_get_cfg(
> {
> struct xfs_error_cfg *cfg;
>
> + if (error < 0)
> + error = -error;
> +
> switch (error) {
> case EIO:
> cfg = &mp->m_error_cfg[error_class][XFS_ERR_EIO];
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
--
Carlos
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2016-07-19 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 19:32 [PATCH] xfs: fix xfs_error_get_cfg for negative errnos Eric Sandeen
2016-07-09 4:26 ` [PATCH 2/1] " Eric Sandeen
2016-07-09 4:28 ` [PATCH 2/1 V2] xfs: remove extraneous buffer flag changes Eric Sandeen
2016-07-19 7:57 ` Carlos Maiolino
2016-07-09 4:33 ` [PATCH 3/1] xfs: don't reset b_retries to 0 on every failure Eric Sandeen
2016-07-19 7:42 ` Carlos Maiolino
2016-07-19 7:52 ` Carlos Maiolino [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=20160719075255.GB8134@redhat.com \
--to=cmaiolino@redhat.com \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/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