Whamcloud - gitweb
LU-2743 ptlrpc: Translate between host and network errnos
authorLi Wei <wei.g.li@intel.com>
Thu, 14 Mar 2013 14:48:48 +0000 (22:48 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 7 Jun 2013 03:53:12 +0000 (23:53 -0400)
commitd98a6fefc9fcb67320502990613ca9deb934b4d6
treeacac0c47172203ccf48a67c49296a43ad695cd12
parent19e544099dfa32b8d020c07f65d8153994c9a33e
LU-2743 ptlrpc: Translate between host and network errnos

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.

Change-Id: I98a1421e90f0ddd1d1b558d2c4afbebbd6dc42bd
Signed-off-by: Li Wei <wei.g.li@intel.com>
Reviewed-on: http://review.whamcloud.com/5577
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
19 files changed:
lustre/include/lustre/Makefile.am
lustre/include/lustre/lustre_errno.h [new file with mode: 0644]
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_net.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_hsm.c
lustre/ofd/ofd_dlm.c
lustre/osc/osc_request.c
lustre/ptlrpc/Makefile.in
lustre/ptlrpc/autoMakefile.am
lustre/ptlrpc/errno.c [new file with mode: 0644]
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/pack_generic.c
lustre/target/tgt_lastrcvd.c