mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 18:55:12 +00:00
nfsd: move nfserrno() to vfs.c
[ Upstream commit cb12fae1c3
]
nfserrno() is common to all nfs versions, but nfsproc.c is specifically
for NFSv2. Move it to vfs.c, and the prototype to vfs.h.
While we're in here, remove the #ifdef EDQUOT check in this function.
It's apparently a holdover from the initial merge of the nfsd code in
1997. No other place in the kernel checks that that symbol is defined
before using it, so I think we can dispense with it here.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bfef0cfab4
commit
850333a25a
@ -12,6 +12,7 @@
|
||||
#include "blocklayoutxdr.h"
|
||||
#include "pnfs.h"
|
||||
#include "filecache.h"
|
||||
#include "vfs.h"
|
||||
|
||||
#define NFSDDBG_FACILITY NFSDDBG_PNFS
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "nfsd.h"
|
||||
#include "blocklayoutxdr.h"
|
||||
#include "vfs.h"
|
||||
|
||||
#define NFSDDBG_FACILITY NFSDDBG_PNFS
|
||||
|
||||
|
@ -115,7 +115,6 @@ struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
|
||||
int exp_rootfh(struct net *, struct auth_domain *,
|
||||
char *path, struct knfsd_fh *, int maxsize);
|
||||
__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
|
||||
__be32 nfserrno(int errno);
|
||||
|
||||
static inline void exp_put(struct svc_export *exp)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "flexfilelayoutxdr.h"
|
||||
#include "pnfs.h"
|
||||
#include "vfs.h"
|
||||
|
||||
#define NFSDDBG_FACILITY NFSDDBG_PNFS
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "idmap.h"
|
||||
#include "nfsd.h"
|
||||
#include "netns.h"
|
||||
#include "vfs.h"
|
||||
|
||||
/*
|
||||
* Turn off idmapping when using AUTH_SYS.
|
||||
|
@ -848,65 +848,3 @@ const struct svc_version nfsd_version2 = {
|
||||
.vs_dispatch = nfsd_dispatch,
|
||||
.vs_xdrsize = NFS2_SVC_XDRSIZE,
|
||||
};
|
||||
|
||||
/*
|
||||
* Map errnos to NFS errnos.
|
||||
*/
|
||||
__be32
|
||||
nfserrno (int errno)
|
||||
{
|
||||
static struct {
|
||||
__be32 nfserr;
|
||||
int syserr;
|
||||
} nfs_errtbl[] = {
|
||||
{ nfs_ok, 0 },
|
||||
{ nfserr_perm, -EPERM },
|
||||
{ nfserr_noent, -ENOENT },
|
||||
{ nfserr_io, -EIO },
|
||||
{ nfserr_nxio, -ENXIO },
|
||||
{ nfserr_fbig, -E2BIG },
|
||||
{ nfserr_stale, -EBADF },
|
||||
{ nfserr_acces, -EACCES },
|
||||
{ nfserr_exist, -EEXIST },
|
||||
{ nfserr_xdev, -EXDEV },
|
||||
{ nfserr_mlink, -EMLINK },
|
||||
{ nfserr_nodev, -ENODEV },
|
||||
{ nfserr_notdir, -ENOTDIR },
|
||||
{ nfserr_isdir, -EISDIR },
|
||||
{ nfserr_inval, -EINVAL },
|
||||
{ nfserr_fbig, -EFBIG },
|
||||
{ nfserr_nospc, -ENOSPC },
|
||||
{ nfserr_rofs, -EROFS },
|
||||
{ nfserr_mlink, -EMLINK },
|
||||
{ nfserr_nametoolong, -ENAMETOOLONG },
|
||||
{ nfserr_notempty, -ENOTEMPTY },
|
||||
#ifdef EDQUOT
|
||||
{ nfserr_dquot, -EDQUOT },
|
||||
#endif
|
||||
{ nfserr_stale, -ESTALE },
|
||||
{ nfserr_jukebox, -ETIMEDOUT },
|
||||
{ nfserr_jukebox, -ERESTARTSYS },
|
||||
{ nfserr_jukebox, -EAGAIN },
|
||||
{ nfserr_jukebox, -EWOULDBLOCK },
|
||||
{ nfserr_jukebox, -ENOMEM },
|
||||
{ nfserr_io, -ETXTBSY },
|
||||
{ nfserr_notsupp, -EOPNOTSUPP },
|
||||
{ nfserr_toosmall, -ETOOSMALL },
|
||||
{ nfserr_serverfault, -ESERVERFAULT },
|
||||
{ nfserr_serverfault, -ENFILE },
|
||||
{ nfserr_io, -EREMOTEIO },
|
||||
{ nfserr_stale, -EOPENSTALE },
|
||||
{ nfserr_io, -EUCLEAN },
|
||||
{ nfserr_perm, -ENOKEY },
|
||||
{ nfserr_no_grace, -ENOGRACE},
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
|
||||
if (nfs_errtbl[i].syserr == errno)
|
||||
return nfs_errtbl[i].nfserr;
|
||||
}
|
||||
WARN_ONCE(1, "nfsd: non-standard errno: %d\n", errno);
|
||||
return nfserr_io;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,69 @@
|
||||
|
||||
#define NFSDDBG_FACILITY NFSDDBG_FILEOP
|
||||
|
||||
/**
|
||||
* nfserrno - Map Linux errnos to NFS errnos
|
||||
* @errno: POSIX(-ish) error code to be mapped
|
||||
*
|
||||
* Returns the appropriate (net-endian) nfserr_* (or nfs_ok if errno is 0). If
|
||||
* it's an error we don't expect, log it once and return nfserr_io.
|
||||
*/
|
||||
__be32
|
||||
nfserrno (int errno)
|
||||
{
|
||||
static struct {
|
||||
__be32 nfserr;
|
||||
int syserr;
|
||||
} nfs_errtbl[] = {
|
||||
{ nfs_ok, 0 },
|
||||
{ nfserr_perm, -EPERM },
|
||||
{ nfserr_noent, -ENOENT },
|
||||
{ nfserr_io, -EIO },
|
||||
{ nfserr_nxio, -ENXIO },
|
||||
{ nfserr_fbig, -E2BIG },
|
||||
{ nfserr_stale, -EBADF },
|
||||
{ nfserr_acces, -EACCES },
|
||||
{ nfserr_exist, -EEXIST },
|
||||
{ nfserr_xdev, -EXDEV },
|
||||
{ nfserr_mlink, -EMLINK },
|
||||
{ nfserr_nodev, -ENODEV },
|
||||
{ nfserr_notdir, -ENOTDIR },
|
||||
{ nfserr_isdir, -EISDIR },
|
||||
{ nfserr_inval, -EINVAL },
|
||||
{ nfserr_fbig, -EFBIG },
|
||||
{ nfserr_nospc, -ENOSPC },
|
||||
{ nfserr_rofs, -EROFS },
|
||||
{ nfserr_mlink, -EMLINK },
|
||||
{ nfserr_nametoolong, -ENAMETOOLONG },
|
||||
{ nfserr_notempty, -ENOTEMPTY },
|
||||
{ nfserr_dquot, -EDQUOT },
|
||||
{ nfserr_stale, -ESTALE },
|
||||
{ nfserr_jukebox, -ETIMEDOUT },
|
||||
{ nfserr_jukebox, -ERESTARTSYS },
|
||||
{ nfserr_jukebox, -EAGAIN },
|
||||
{ nfserr_jukebox, -EWOULDBLOCK },
|
||||
{ nfserr_jukebox, -ENOMEM },
|
||||
{ nfserr_io, -ETXTBSY },
|
||||
{ nfserr_notsupp, -EOPNOTSUPP },
|
||||
{ nfserr_toosmall, -ETOOSMALL },
|
||||
{ nfserr_serverfault, -ESERVERFAULT },
|
||||
{ nfserr_serverfault, -ENFILE },
|
||||
{ nfserr_io, -EREMOTEIO },
|
||||
{ nfserr_stale, -EOPENSTALE },
|
||||
{ nfserr_io, -EUCLEAN },
|
||||
{ nfserr_perm, -ENOKEY },
|
||||
{ nfserr_no_grace, -ENOGRACE},
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
|
||||
if (nfs_errtbl[i].syserr == errno)
|
||||
return nfs_errtbl[i].nfserr;
|
||||
}
|
||||
WARN_ONCE(1, "nfsd: non-standard errno: %d\n", errno);
|
||||
return nfserr_io;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from nfsd_lookup and encode_dirent. Check if we have crossed
|
||||
* a mount point.
|
||||
|
@ -60,6 +60,7 @@ static inline void nfsd_attrs_free(struct nfsd_attrs *attrs)
|
||||
posix_acl_release(attrs->na_dpacl);
|
||||
}
|
||||
|
||||
__be32 nfserrno (int errno);
|
||||
int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
|
||||
struct svc_export **expp);
|
||||
__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
|
||||
|
Loading…
Reference in New Issue
Block a user