Re: [PATCH 11/48] staging/lustre/ptlrpc: Translate between host andnetwork errnos
From: Paul Bolle
Date: Mon Jul 22 2013 - 12:30:00 EST
On Tue, 2013-07-23 at 00:06 +0800, Peng Tao wrote:
> From: Li Wei <wei.g.li@xxxxxxxxx>
>
> Lustre puts system errors (e.g., ENOTCONN) on wire as numbers
> essentially specific to senders' architectures. While this is fine
> for x86-only sites, where receivers share the same error number
> definition with senders, problems will arise, however, for sites
> involving multiple architectures with different error number
> definitions. For instance, an ENOTCONN reply from a sparc server will
> be put on wire as -57, which, for an x86 client, means EBADSLT
> instead.
>
> To solve the problem, this patch defines a set of network errors for
> on-wire or on-disk uses. These errors correspond to a subset of the
> x86 system errors and share the same number definition, maintaining
> compatibility with existing x86 clients and servers.
>
> Then, either error numbers could be translated at run time, or all
> host errors going on wire could be replaced with network errors in the
> code. This patch does the former by introducing both generic and
> field-specific translation routines and calling them at proper places,
> so that translations for existing fields are transparent.
> (Personally, I tend to think the latter way might be worthwhile, as it
> is more straightforward conceptually. Do we really need so many
> different errors? Should errors returned by kernel routines really be
> passed up and eventually put on wire? There could even be security
> implications in that.)
>
> Thank Fujitsu for the original idea and their contributions that make
> this available upstream.
>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2743
> Lustre-change: http://review.whamcloud.com/5577
> Signed-off-by: Li Wei <wei.g.li@xxxxxxxxx>
> Reviewed-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
> Reviewed-by: Hiroya Nozaki <nozaki.hiroya@xxxxxxxxxxxxxx>
> Reviewed-by: Oleg Drokin <oleg.drokin@xxxxxxxxx>
> Signed-off-by: Peng Tao <tao.peng@xxxxxxx>
> Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
> ---
> drivers/staging/lustre/lustre/Kconfig | 5 +
> .../lustre/lustre/include/lustre/lustre_errno.h | 215 +++++++++++
> .../lustre/lustre/include/lustre/lustre_idl.h | 2 +
> drivers/staging/lustre/lustre/include/lustre_net.h | 32 ++
> drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 3 +-
> drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +
> drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 6 +-
> drivers/staging/lustre/lustre/mdc/mdc_locks.c | 10 +
> drivers/staging/lustre/lustre/mdc/mdc_request.c | 1 +
> drivers/staging/lustre/lustre/osc/osc_request.c | 2 +
> drivers/staging/lustre/lustre/ptlrpc/Makefile | 1 +
> drivers/staging/lustre/lustre/ptlrpc/errno.c | 382 ++++++++++++++++++++
> drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 +-
> .../staging/lustre/lustre/ptlrpc/pack_generic.c | 3 +
> 14 files changed, 662 insertions(+), 5 deletions(-)
> create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_errno.h
> create mode 100644 drivers/staging/lustre/lustre/ptlrpc/errno.c
>
> diff --git a/drivers/staging/lustre/lustre/Kconfig b/drivers/staging/lustre/lustre/Kconfig
> index 0a8eb1ad..19a1c33 100644
> --- a/drivers/staging/lustre/lustre/Kconfig
> +++ b/drivers/staging/lustre/lustre/Kconfig
> @@ -59,3 +59,8 @@ config LUSTRE_DEBUG_EXPENSIVE_CHECK
> expensive checks that may have a performance impact.
>
> Use with caution. If unsure, say N.
> +
> +config LUSTRE_TRANSLATE_ERRNOS
> + bool
> + depends on LUSTRE_FS && !X86
> + default true
Did you mean "default y"?
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/