nfs4_subr.c revision 416a371adc6af53e81dcf9bee06b38cc1fa8e48d
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
#ifdef DEBUG
#ifdef DEBUG
#ifdef DEBUG
static int nfs4_rfscall_debug;
static int nfs4_try_failover_any;
int nfs4_utf8_debug = 0;
typedef struct rddir4_cache_impl {
static int rddir4_cache_compar(const void *, const void *);
static int nfs4_readdir_cache_hits = 0;
static int nfs4_readdir_cache_waits = 0;
static int nfs4_readdir_cache_misses = 0;
switch (error) {
return (NFS4_OK);
case EPERM:
return (NFS4ERR_PERM);
case ENOENT:
return (NFS4ERR_NOENT);
case EINTR:
return (NFS4ERR_IO);
case EIO:
return (NFS4ERR_IO);
case ENXIO:
return (NFS4ERR_NXIO);
case ENOMEM:
return (NFS4ERR_RESOURCE);
case EACCES:
return (NFS4ERR_ACCESS);
case EBUSY:
return (NFS4ERR_IO);
case EEXIST:
return (NFS4ERR_EXIST);
case EXDEV:
return (NFS4ERR_XDEV);
case ENODEV:
return (NFS4ERR_IO);
case ENOTDIR:
return (NFS4ERR_NOTDIR);
case EISDIR:
return (NFS4ERR_ISDIR);
case EINVAL:
return (NFS4ERR_INVAL);
case EMFILE:
return (NFS4ERR_RESOURCE);
case EFBIG:
return (NFS4ERR_FBIG);
case ENOSPC:
return (NFS4ERR_NOSPC);
case EROFS:
return (NFS4ERR_ROFS);
case EMLINK:
return (NFS4ERR_MLINK);
case EDEADLK:
return (NFS4ERR_DEADLOCK);
case ENOLCK:
return (NFS4ERR_DENIED);
case EREMOTE:
return (NFS4ERR_SERVERFAULT);
case ENOTSUP:
return (NFS4ERR_NOTSUPP);
case EDQUOT:
return (NFS4ERR_DQUOT);
case ENAMETOOLONG:
return (NFS4ERR_NAMETOOLONG);
case EOVERFLOW:
return (NFS4ERR_INVAL);
case ENOSYS:
return (NFS4ERR_NOTSUPP);
case ENOTEMPTY:
return (NFS4ERR_NOTEMPTY);
case EOPNOTSUPP:
return (NFS4ERR_NOTSUPP);
case ESTALE:
return (NFS4ERR_STALE);
case EAGAIN:
return (NFS4ERR_DELAY);
return (NFS4ERR_LOCKED);
switch (status) {
case NFS4_OK:
case NFS4ERR_PERM:
return (EPERM);
case NFS4ERR_NOENT:
return (ENOENT);
case NFS4ERR_IO:
return (EIO);
case NFS4ERR_NXIO:
return (ENXIO);
case NFS4ERR_ACCESS:
return (EACCES);
case NFS4ERR_EXIST:
return (EEXIST);
case NFS4ERR_XDEV:
return (EXDEV);
case NFS4ERR_NOTDIR:
return (ENOTDIR);
case NFS4ERR_ISDIR:
return (EISDIR);
case NFS4ERR_INVAL:
return (EINVAL);
case NFS4ERR_FBIG:
return (EFBIG);
case NFS4ERR_NOSPC:
return (ENOSPC);
case NFS4ERR_ROFS:
return (EROFS);
case NFS4ERR_MLINK:
return (EMLINK);
case NFS4ERR_NAMETOOLONG:
return (ENAMETOOLONG);
case NFS4ERR_NOTEMPTY:
return (ENOTEMPTY);
case NFS4ERR_DQUOT:
return (EDQUOT);
case NFS4ERR_STALE:
return (ESTALE);
case NFS4ERR_BADHANDLE:
return (ESTALE);
case NFS4ERR_BAD_COOKIE:
return (EINVAL);
case NFS4ERR_NOTSUPP:
return (EOPNOTSUPP);
case NFS4ERR_TOOSMALL:
return (EINVAL);
case NFS4ERR_SERVERFAULT:
return (EIO);
case NFS4ERR_BADTYPE:
return (EINVAL);
case NFS4ERR_DELAY:
return (ENXIO);
case NFS4ERR_SAME:
return (EPROTO);
case NFS4ERR_DENIED:
return (ENOLCK);
case NFS4ERR_EXPIRED:
return (EPROTO);
case NFS4ERR_LOCKED:
return (EACCES);
case NFS4ERR_GRACE:
return (EAGAIN);
return (ESTALE);
case NFS4ERR_SHARE_DENIED:
return (EACCES);
case NFS4ERR_WRONGSEC:
return (EPERM);
case NFS4ERR_CLID_INUSE:
return (EAGAIN);
case NFS4ERR_RESOURCE:
return (EAGAIN);
case NFS4ERR_MOVED:
return (EPROTO);
case NFS4ERR_NOFILEHANDLE:
return (EIO);
return (ENOTSUP);
case NFS4ERR_STALE_CLIENTID:
return (EIO);
case NFS4ERR_STALE_STATEID:
return (EIO);
case NFS4ERR_OLD_STATEID:
return (EIO);
case NFS4ERR_BAD_STATEID:
return (EIO);
case NFS4ERR_BAD_SEQID:
return (EIO);
case NFS4ERR_NOT_SAME:
return (EPROTO);
case NFS4ERR_LOCK_RANGE:
return (EPROTO);
case NFS4ERR_SYMLINK:
return (EPROTO);
case NFS4ERR_RESTOREFH:
return (EPROTO);
case NFS4ERR_LEASE_MOVED:
return (EPROTO);
case NFS4ERR_ATTRNOTSUPP:
return (ENOTSUP);
case NFS4ERR_NO_GRACE:
return (EPROTO);
case NFS4ERR_RECLAIM_BAD:
return (EPROTO);
case NFS4ERR_RECLAIM_CONFLICT:
return (EPROTO);
case NFS4ERR_BADXDR:
return (EINVAL);
case NFS4ERR_LOCKS_HELD:
return (EIO);
case NFS4ERR_OPENMODE:
return (EACCES);
case NFS4ERR_BADOWNER:
return (EACCES);
case NFS4ERR_BADCHAR:
return (EINVAL);
case NFS4ERR_BADNAME:
return (EINVAL);
case NFS4ERR_BAD_RANGE:
return (EIO);
case NFS4ERR_LOCK_NOTSUPP:
return (ENOTSUP);
case NFS4ERR_OP_ILLEGAL:
return (EINVAL);
case NFS4ERR_DEADLOCK:
return (EDEADLK);
case NFS4ERR_FILE_OPEN:
return (EACCES);
case NFS4ERR_ADMIN_REVOKED:
return (EPROTO);
case NFS4ERR_CB_PATH_DOWN:
return (EPROTO);
#ifdef DEBUG
status);
return ((int)status);
#ifndef _LP64
return (EOVERFLOW);
return (EINVAL);
return (NULL);
#ifdef DEBUG
if (nfs4_utf8_debug) {
char *path;
return (NULL);
char *sp;
char *u8p;
int len;
return (NULL);
return (NULL);
sp = s;
for (i = 0; i < len; i++) {
#ifdef DEBUG
if (s == NULL)
return (NULL);
return (sp);
int len;
return (NULL);
return (str);
return (NULL);
return (NULL);
KM_SLEEP);
return (dest);
else if (a == NULL)
else if (b == NULL)
else if (cmp == 0)
else if (cmp < 0)
char *nm;
int len;
int error, i;
* ETIMEDOUT/ECONNRESET occurs.
return (error);
int error;
return (EINVAL);
top:
KM_SLEEP);
goto top;
#ifdef DEBUG
if (error != 0) {
#ifdef DEBUG
return (error);
#ifdef DEBUG
if (error == 0)
firstcall = 0;
return (error);
#ifdef DEBUG
#ifdef DEBUG
#ifdef DEBUG
static unsigned int minimum_timeo[] = {
int error;
#ifdef DEBUG
char *bufp;
int firstcall;
return (EIO);
if (cred_cloned)
return (EIO);
if (cred_cloned)
return (EIO);
if (cred_cloned)
return (EIO);
firstcall = 0;
switch (status) {
case RPC_SUCCESS:
case RPC_INTR:
case RPC_UDERROR:
#ifdef DEBUG
if (cred_cloned)
return (EIO);
if (cred_cloned)
return (error);
*doqueue = 0;
0, NULL);
} while (tryagain);
#ifdef DEBUG
if (nfs_has_ctty()) {
bufp);
if (nfs_has_ctty()) {
if (*doqueue == 0) {
if (cred_cloned)
int i, error;
int num_resops;
if (error) {
for (i = 0; i < num_resops; i++) {
int num_argops;
char *path;
switch (filetype) {
case RML_NAMED_ATTR:
case RML_ATTRDIR:
case RML_ORDINARY:
goto exit;
goto exit;
TAG_NONE, 0, 0);
goto exit;
goto exit;
goto exit;
TAG_NONE, 0, 0);
goto exit;
exit:
int is_stub;
int badfhcount = 0;
goto done;
goto get_remap_cred;
goto done;
case NFS4_OK:
badfhcount = 0;
case NFS4ERR_FHEXPIRED:
case NFS4ERR_BADHANDLE:
if (badfhcount++ > 0)
goto done;
goto done;
goto done;
goto again;
case NFS4ERR_DELAY:
badfhcount = 0;
goto done;
goto again;
case NFS4ERR_ACCESS:
goto done;
goto get_remap_cred;
goto done;
goto done;
is_stub = 0;
#ifdef DEBUG
(void *)rp));
if (is_stub)
done:
#ifdef DEBUG
if (e.error != 0)
goto out;
goto out;
if (need_start_op) {
if (e.error != 0) {
goto out;
if (need_start_op) {
NULL);
if (abort) {
if (e.error == 0)
goto out;
goto recov_retry;
if (e.error == 0)
goto out;
if (!e.error) {
if ((e.error != 0) ||
if (need_start_op)
if (e.error == 0)
goto out;
if (need_start_op)
goto out;
if (need_start_op) {
if (abort) {
FALSE);
if (e.error == 0)
goto out;
goto recov_retry;
if (e.error == 0)
goto out;
if (need_start_op)
goto out;
(e.error != 0) ||
if (need_start_op)
if (e.error == 0)
goto out;
if (need_start_op)
out:
return (e.error);
#ifdef DEBUG
int *ip;
char *buf;
char *cp;
cp++;
ip++) {
cp++;
rddir4_cache_compar(const void *x, const void *y)
top:
return (rdc);
return (nrdc);
return (nrdc);
#ifdef DEBUG
return (nrdc);
goto top;
#ifdef DEBUG
#ifdef DEBUG
return (NULL);
goto top;
return (rdc);
static rddir4_cache *
#ifdef DEBUG
return (rc);
#ifdef DEBUG
#ifdef DEBUG
#ifdef DEBUG
sizeof (clstat4_debug));
#ifdef DEBUG
return (nfscl);
nfs4_subr_init(void)
NULL, 0);
if (nfs4err_delay_time == 0)
nfs4_subr_fini(void)
int error = 0;
if (error) {
return (error);
return (EINVAL);
static struct try_failover_tab {
int error;
} try_failover_table [] = {
RPC_SUCCESS, 0,
RPC_VERSMISMATCH, 0,
RPC_AUTHERROR, 0,
RPC_PROGUNAVAIL, 0,
RPC_PROCUNAVAIL, 0,
RPC_INTR, 0,
RPC_TLIERROR, 0,
RPC_UDERROR, 0,
RPC_INPROGRESS, 0,
return (TRUE);
return (FALSE);
int err = 0;
#ifdef DEBUG
goto done;
#ifdef DEBUG
done:
if (rpc_status)
return (err);
#ifdef DEBUG
int i, rem;
for (i = 0; i < rem; i++)
char *path;
char *type;
return (buf);