]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xfs: fix xfs_error_get_cfg for negative errnos
authorEric Sandeen <sandeen@redhat.com>
Wed, 20 Jul 2016 00:48:51 +0000 (10:48 +1000)
committerChuck Anderson <chuck.anderson@oracle.com>
Sat, 10 Jun 2017 00:25:18 +0000 (17:25 -0700)
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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
(cherry picked from commit e97f6c545f963abd7de56a58a29ba73a9edee015)

Orabug: 26130728

Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
fs/xfs/xfs_sysfs.c

index 2be00e7822c74ef8e0e77288255a7fcdf515c7c2..08d966f38a9ba4479c372c7bde59b446594b7a73 100644 (file)
@@ -543,6 +543,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];