NFS: Fix the mapping of the NFSERR_SERVERFAULT error

It was recently pointed out that the NFSERR_SERVERFAULT error, which is
designed to inform the user of a serious internal error on the server, was
being mapped to an error value that is internal to the kernel.

This patch maps it to the error EREMOTEIO, which is exported to userland
through errno.h.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org

+5 -5
+1 -1
fs/nfs/mount_clnt.c
··· 120 { .status = MNT3ERR_INVAL, .errno = -EINVAL, }, 121 { .status = MNT3ERR_NAMETOOLONG, .errno = -ENAMETOOLONG, }, 122 { .status = MNT3ERR_NOTSUPP, .errno = -ENOTSUPP, }, 123 - { .status = MNT3ERR_SERVERFAULT, .errno = -ESERVERFAULT, }, 124 }; 125 126 struct mountres {
··· 120 { .status = MNT3ERR_INVAL, .errno = -EINVAL, }, 121 { .status = MNT3ERR_NAMETOOLONG, .errno = -ENAMETOOLONG, }, 122 { .status = MNT3ERR_NOTSUPP, .errno = -ENOTSUPP, }, 123 + { .status = MNT3ERR_SERVERFAULT, .errno = -EREMOTEIO, }, 124 }; 125 126 struct mountres {
+1 -1
fs/nfs/nfs2xdr.c
··· 699 { NFSERR_BAD_COOKIE, -EBADCOOKIE }, 700 { NFSERR_NOTSUPP, -ENOTSUPP }, 701 { NFSERR_TOOSMALL, -ETOOSMALL }, 702 - { NFSERR_SERVERFAULT, -ESERVERFAULT }, 703 { NFSERR_BADTYPE, -EBADTYPE }, 704 { NFSERR_JUKEBOX, -EJUKEBOX }, 705 { -1, -EIO }
··· 699 { NFSERR_BAD_COOKIE, -EBADCOOKIE }, 700 { NFSERR_NOTSUPP, -ENOTSUPP }, 701 { NFSERR_TOOSMALL, -ETOOSMALL }, 702 + { NFSERR_SERVERFAULT, -EREMOTEIO }, 703 { NFSERR_BADTYPE, -EBADTYPE }, 704 { NFSERR_JUKEBOX, -EJUKEBOX }, 705 { -1, -EIO }
+3 -3
fs/nfs/nfs4xdr.c
··· 4631 * If the server returns different values for sessionID, slotID or 4632 * sequence number, the server is looney tunes. 4633 */ 4634 - status = -ESERVERFAULT; 4635 4636 if (memcmp(id.data, res->sr_session->sess_id.data, 4637 NFS4_MAX_SESSIONID_LEN)) { ··· 5774 { NFS4ERR_BAD_COOKIE, -EBADCOOKIE }, 5775 { NFS4ERR_NOTSUPP, -ENOTSUPP }, 5776 { NFS4ERR_TOOSMALL, -ETOOSMALL }, 5777 - { NFS4ERR_SERVERFAULT, -ESERVERFAULT }, 5778 { NFS4ERR_BADTYPE, -EBADTYPE }, 5779 { NFS4ERR_LOCKED, -EAGAIN }, 5780 { NFS4ERR_SYMLINK, -ELOOP }, ··· 5801 } 5802 if (stat <= 10000 || stat > 10100) { 5803 /* The server is looney tunes. */ 5804 - return -ESERVERFAULT; 5805 } 5806 /* If we cannot translate the error, the recovery routines should 5807 * handle it.
··· 4631 * If the server returns different values for sessionID, slotID or 4632 * sequence number, the server is looney tunes. 4633 */ 4634 + status = -EREMOTEIO; 4635 4636 if (memcmp(id.data, res->sr_session->sess_id.data, 4637 NFS4_MAX_SESSIONID_LEN)) { ··· 5774 { NFS4ERR_BAD_COOKIE, -EBADCOOKIE }, 5775 { NFS4ERR_NOTSUPP, -ENOTSUPP }, 5776 { NFS4ERR_TOOSMALL, -ETOOSMALL }, 5777 + { NFS4ERR_SERVERFAULT, -EREMOTEIO }, 5778 { NFS4ERR_BADTYPE, -EBADTYPE }, 5779 { NFS4ERR_LOCKED, -EAGAIN }, 5780 { NFS4ERR_SYMLINK, -ELOOP }, ··· 5801 } 5802 if (stat <= 10000 || stat > 10100) { 5803 /* The server is looney tunes. */ 5804 + return -EREMOTEIO; 5805 } 5806 /* If we cannot translate the error, the recovery routines should 5807 * handle it.