All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix xfs_error_get_cfg for negative errnos
@ 2016-07-08 19:32 Eric Sandeen
  2016-07-09  4:26 ` [PATCH 2/1] " Eric Sandeen
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Eric Sandeen @ 2016-07-08 19:32 UTC (permalink / raw)
  To: xfs-oss

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

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-19  7:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] xfs: fix xfs_error_get_cfg for negative errnos Carlos Maiolino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.