MFC: r203731
Some style(9) fixes
This commit is contained in:
parent
8bcb69bcdf
commit
f029cae71f
@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* These functions support the macros and help fiddle mbuf chains for
|
||||
* the nfs op functions. They do things like create the rpc header and
|
||||
* the nfs op functions. They do things like create the rpc header and
|
||||
* copy data between mbuf chains and uio lists.
|
||||
*/
|
||||
|
||||
@ -77,7 +77,8 @@ nfstype nfsv3_type[9] = {
|
||||
NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFSOCK, NFFIFO, NFNON
|
||||
};
|
||||
|
||||
static void *nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos, int how);
|
||||
static void *nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos,
|
||||
int how);
|
||||
|
||||
SYSCTL_NODE(_vfs, OID_AUTO, nfs_common, CTLFLAG_RD, 0, "NFS common support");
|
||||
|
||||
@ -90,7 +91,7 @@ SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_count, CTLFLAG_RD,
|
||||
&nfs_realign_count, 0, "Number of mbuf realignments done");
|
||||
|
||||
u_quad_t
|
||||
nfs_curusec(void)
|
||||
nfs_curusec(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
@ -188,7 +189,7 @@ nfsm_disct(struct mbuf **mdp, caddr_t *dposp, int siz, int left, int how)
|
||||
while (left == 0) {
|
||||
*mdp = mp = mp->m_next;
|
||||
if (mp == NULL)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
left = mp->m_len;
|
||||
*dposp = mtod(mp, caddr_t);
|
||||
}
|
||||
@ -196,13 +197,13 @@ nfsm_disct(struct mbuf **mdp, caddr_t *dposp, int siz, int left, int how)
|
||||
ret = *dposp;
|
||||
*dposp += siz;
|
||||
} else if (mp->m_next == NULL) {
|
||||
return NULL;
|
||||
return (NULL);
|
||||
} else if (siz > MHLEN) {
|
||||
panic("nfs S too big");
|
||||
} else {
|
||||
MGET(mp2, how, MT_DATA);
|
||||
if (mp2 == NULL)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
mp2->m_len = siz;
|
||||
mp2->m_next = mp->m_next;
|
||||
mp->m_next = mp2;
|
||||
@ -218,7 +219,7 @@ nfsm_disct(struct mbuf **mdp, caddr_t *dposp, int siz, int left, int how)
|
||||
/* Loop around copying up the siz2 bytes */
|
||||
while (siz2 > 0) {
|
||||
if (mp2 == NULL)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
xfer = (siz2 > mp2->m_len) ? mp2->m_len : siz2;
|
||||
if (xfer > 0) {
|
||||
bcopy(mtod(mp2, caddr_t), ptr, xfer);
|
||||
@ -241,7 +242,7 @@ nfsm_disct(struct mbuf **mdp, caddr_t *dposp, int siz, int left, int how)
|
||||
*dposp = npos;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -285,19 +286,21 @@ nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos)
|
||||
ret = *bpos;
|
||||
(*mb)->m_len += s;
|
||||
*bpos += s;
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void *
|
||||
nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos)
|
||||
{
|
||||
return nfsm_dissect_xx_sub(s, md, dpos, M_WAIT);
|
||||
|
||||
return (nfsm_dissect_xx_sub(s, md, dpos, M_WAIT));
|
||||
}
|
||||
|
||||
void *
|
||||
nfsm_dissect_xx_nonblock(int s, struct mbuf **md, caddr_t *dpos)
|
||||
{
|
||||
return nfsm_dissect_xx_sub(s, md, dpos, M_DONTWAIT);
|
||||
|
||||
return (nfsm_dissect_xx_sub(s, md, dpos, M_DONTWAIT));
|
||||
}
|
||||
|
||||
static void *
|
||||
@ -311,10 +314,10 @@ nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos, int how)
|
||||
if (t1 >= s) {
|
||||
ret = *dpos;
|
||||
*dpos += s;
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
cp2 = nfsm_disct(md, dpos, s, t1, how);
|
||||
return cp2;
|
||||
cp2 = nfsm_disct(md, dpos, s, t1, how);
|
||||
return (cp2);
|
||||
}
|
||||
|
||||
int
|
||||
@ -324,11 +327,11 @@ nfsm_strsiz_xx(int *s, int m, struct mbuf **mb, caddr_t *bpos)
|
||||
|
||||
tl = nfsm_dissect_xx(NFSX_UNSIGNED, mb, bpos);
|
||||
if (tl == NULL)
|
||||
return EBADRPC;
|
||||
return (EBADRPC);
|
||||
*s = fxdr_unsigned(int32_t, *tl);
|
||||
if (*s > m)
|
||||
return EBADRPC;
|
||||
return 0;
|
||||
return (EBADRPC);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -339,12 +342,12 @@ nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos)
|
||||
t1 = mtod(*md, caddr_t) + (*md)->m_len - *dpos;
|
||||
if (t1 >= s) {
|
||||
*dpos += s;
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
t1 = nfs_adv(md, dpos, s, t1);
|
||||
if (t1)
|
||||
return t1;
|
||||
return 0;
|
||||
return (t1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NFS_NFS_COMMON_H_
|
||||
#define _NFS_NFS_COMMON_H_
|
||||
|
||||
@ -87,7 +86,7 @@ do { \
|
||||
goto nfsmout; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define nfsm_dissect(c, s) \
|
||||
({ \
|
||||
void *ret; \
|
||||
|
@ -99,9 +99,11 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0,
|
||||
"Buffer reservation size 2 < x < 64");
|
||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0,
|
||||
"Number of times the nfs client has had to reconnect");
|
||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW, &nfs3_jukebox_delay, 0,
|
||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW,
|
||||
&nfs3_jukebox_delay, 0,
|
||||
"Number of seconds to delay a retry after receiving EJUKEBOX");
|
||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0,
|
||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW,
|
||||
&nfs_skip_wcc_data_onerr, 0,
|
||||
"Disable weak cache consistency checking when server returns an error");
|
||||
|
||||
static void nfs_down(struct nfsmount *, struct thread *, const char *,
|
||||
@ -154,7 +156,8 @@ static enum nfs_rto_timer_t nfs_proct[NFS_NPROCS] = {
|
||||
static inline enum nfs_rto_timer_t
|
||||
nfs_rto_timer(u_int32_t procnum)
|
||||
{
|
||||
return nfs_proct[procnum];
|
||||
|
||||
return (nfs_proct[procnum]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -219,7 +222,7 @@ nfs_connect(struct nfsmount *nmp)
|
||||
nconf = getnetconfigent("udp6");
|
||||
else
|
||||
nconf = getnetconfigent("tcp6");
|
||||
|
||||
|
||||
/*
|
||||
* Get buffer reservation size from sysctl, but impose reasonable
|
||||
* limits.
|
||||
@ -267,9 +270,8 @@ nfs_connect(struct nfsmount *nmp)
|
||||
* Someone else already connected.
|
||||
*/
|
||||
CLNT_RELEASE(client);
|
||||
} else {
|
||||
} else
|
||||
nmp->nm_client = client;
|
||||
}
|
||||
|
||||
/*
|
||||
* Protocols that do not require connections may be optionally left
|
||||
@ -278,22 +280,21 @@ nfs_connect(struct nfsmount *nmp)
|
||||
if (!(nmp->nm_flag & NFSMNT_NOCONN)) {
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
CLNT_CONTROL(client, CLSET_CONNECT, &one);
|
||||
} else {
|
||||
} else
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
}
|
||||
|
||||
/* Restore current thread's credentials. */
|
||||
td->td_ucred = origcred;
|
||||
|
||||
mtx_lock(&nmp->nm_mtx);
|
||||
/* Initialize other non-zero congestion variables */
|
||||
/* Initialize other non-zero congestion variables. */
|
||||
nfs_init_rtt(nmp);
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* NFS disconnect. Clean up and unlink.
|
||||
* NFS disconnect. Clean up and unlink.
|
||||
*/
|
||||
void
|
||||
nfs_disconnect(struct nfsmount *nmp)
|
||||
@ -310,9 +311,8 @@ nfs_disconnect(struct nfsmount *nmp)
|
||||
#endif
|
||||
CLNT_CLOSE(client);
|
||||
CLNT_RELEASE(client);
|
||||
} else {
|
||||
} else
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -335,11 +335,10 @@ nfs_getauth(struct nfsmount *nmp, struct ucred *cred)
|
||||
case RPCSEC_GSS_KRB5:
|
||||
case RPCSEC_GSS_KRB5I:
|
||||
case RPCSEC_GSS_KRB5P:
|
||||
if (!nmp->nm_mech_oid) {
|
||||
if (!nmp->nm_mech_oid)
|
||||
if (!rpc_gss_mech_to_oid("kerberosv5",
|
||||
&nmp->nm_mech_oid))
|
||||
&nmp->nm_mech_oid))
|
||||
return (NULL);
|
||||
}
|
||||
if (nmp->nm_secflavor == RPCSEC_GSS_KRB5)
|
||||
svc = rpc_gss_svc_none;
|
||||
else if (nmp->nm_secflavor == RPCSEC_GSS_KRB5I)
|
||||
@ -438,10 +437,10 @@ nfs_request(struct vnode *vp, struct mbuf *mreq, int procnum,
|
||||
nf.nf_td = td;
|
||||
getmicrouptime(&now);
|
||||
nf.nf_lastmsg = now.tv_sec -
|
||||
((nmp->nm_tprintf_delay) - (nmp->nm_tprintf_initial_delay));
|
||||
((nmp->nm_tprintf_delay) - (nmp->nm_tprintf_initial_delay));
|
||||
|
||||
/*
|
||||
* XXX if not already connected call nfs_connect now. Longer
|
||||
* XXX if not already connected call nfs_connect now. Longer
|
||||
* term, change nfs_mount to call nfs_connect unconditionally
|
||||
* and let clnt_reconnect_create handle reconnects.
|
||||
*/
|
||||
@ -461,18 +460,17 @@ nfs_request(struct vnode *vp, struct mbuf *mreq, int procnum,
|
||||
|
||||
/*
|
||||
* Use a conservative timeout for RPCs other than getattr,
|
||||
* lookup, read or write. The justification for doing "other"
|
||||
* lookup, read or write. The justification for doing "other"
|
||||
* this way is that these RPCs happen so infrequently that
|
||||
* timer est. would probably be stale. Also, since many of
|
||||
* these RPCs are non-idempotent, a conservative timeout is
|
||||
* desired.
|
||||
*/
|
||||
timer = nfs_rto_timer(procnum);
|
||||
if (timer != NFS_DEFAULT_TIMER) {
|
||||
if (timer != NFS_DEFAULT_TIMER)
|
||||
ext.rc_timers = &nmp->nm_timers[timer - 1];
|
||||
} else {
|
||||
else
|
||||
ext.rc_timers = NULL;
|
||||
}
|
||||
|
||||
#ifdef KDTRACE_HOOKS
|
||||
if (dtrace_nfsclient_nfs23_start_probe != NULL) {
|
||||
@ -505,17 +503,16 @@ tryagain:
|
||||
* If there was a successful reply and a tprintf msg.
|
||||
* tprintf a response.
|
||||
*/
|
||||
if (stat == RPC_SUCCESS) {
|
||||
if (stat == RPC_SUCCESS)
|
||||
error = 0;
|
||||
} else if (stat == RPC_TIMEDOUT) {
|
||||
else if (stat == RPC_TIMEDOUT)
|
||||
error = ETIMEDOUT;
|
||||
} else if (stat == RPC_VERSMISMATCH) {
|
||||
else if (stat == RPC_VERSMISMATCH)
|
||||
error = EOPNOTSUPP;
|
||||
} else if (stat == RPC_PROGVERSMISMATCH) {
|
||||
else if (stat == RPC_PROGVERSMISMATCH)
|
||||
error = EPROTONOSUPPORT;
|
||||
} else {
|
||||
else
|
||||
error = EACCES;
|
||||
}
|
||||
if (error)
|
||||
goto nfsmout;
|
||||
|
||||
@ -544,9 +541,9 @@ tryagain:
|
||||
m_freem(mrep);
|
||||
error = 0;
|
||||
waituntil = time_second + nfs3_jukebox_delay;
|
||||
while (time_second < waituntil) {
|
||||
(void) tsleep(&fake_wchan, PSOCK, "nqnfstry", hz);
|
||||
}
|
||||
while (time_second < waituntil)
|
||||
(void)tsleep(&fake_wchan, PSOCK, "nqnfstry",
|
||||
hz);
|
||||
goto tryagain;
|
||||
}
|
||||
|
||||
@ -557,12 +554,13 @@ tryagain:
|
||||
if (error == ESTALE)
|
||||
nfs_purgecache(vp);
|
||||
/*
|
||||
* Skip wcc data on NFS errors for now. NetApp filers
|
||||
* Skip wcc data on NFS errors for now. NetApp filers
|
||||
* return corrupt postop attrs in the wcc data for NFS
|
||||
* err EROFS. Not sure if they could return corrupt
|
||||
* err EROFS. Not sure if they could return corrupt
|
||||
* postop attrs for others errors.
|
||||
*/
|
||||
if ((nmp->nm_flag & NFSMNT_NFSV3) && !nfs_skip_wcc_data_onerr) {
|
||||
if ((nmp->nm_flag & NFSMNT_NFSV3) &&
|
||||
!nfs_skip_wcc_data_onerr) {
|
||||
*mrp = mrep;
|
||||
*mdp = md;
|
||||
*dposp = dpos;
|
||||
@ -624,7 +622,7 @@ nfsmout:
|
||||
|
||||
/*
|
||||
* Mark all of an nfs mount's outstanding requests with R_SOFTTERM and
|
||||
* wait for all requests to complete. This is used by forced unmounts
|
||||
* wait for all requests to complete. This is used by forced unmounts
|
||||
* to terminate any outstanding RPCs.
|
||||
*/
|
||||
int
|
||||
@ -638,7 +636,7 @@ nfs_nmcancelreqs(struct nfsmount *nmp)
|
||||
|
||||
/*
|
||||
* Any signal that can interrupt an NFS operation in an intr mount
|
||||
* should be added to this set. SIGSTOP and SIGKILL cannot be masked.
|
||||
* should be added to this set. SIGSTOP and SIGKILL cannot be masked.
|
||||
*/
|
||||
int nfs_sig_set[] = {
|
||||
SIGINT,
|
||||
@ -657,16 +655,16 @@ static int
|
||||
nfs_sig_pending(sigset_t set)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0 ; i < sizeof(nfs_sig_set)/sizeof(int) ; i++)
|
||||
if (SIGISMEMBER(set, nfs_sig_set[i]))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The set/restore sigmask functions are used to (temporarily) overwrite
|
||||
* the process p_sigmask during an RPC call (for example). These are also
|
||||
* the process p_sigmask during an RPC call (for example). These are also
|
||||
* used in other places in the NFS client that might tsleep().
|
||||
*/
|
||||
void
|
||||
@ -675,18 +673,18 @@ nfs_set_sigmask(struct thread *td, sigset_t *oldset)
|
||||
sigset_t newset;
|
||||
int i;
|
||||
struct proc *p;
|
||||
|
||||
|
||||
SIGFILLSET(newset);
|
||||
if (td == NULL)
|
||||
td = curthread; /* XXX */
|
||||
p = td->td_proc;
|
||||
/* Remove the NFS set of signals from newset */
|
||||
/* Remove the NFS set of signals from newset. */
|
||||
PROC_LOCK(p);
|
||||
mtx_lock(&p->p_sigacts->ps_mtx);
|
||||
for (i = 0 ; i < sizeof(nfs_sig_set)/sizeof(int) ; i++) {
|
||||
/*
|
||||
* But make sure we leave the ones already masked
|
||||
* by the process, ie. remove the signal from the
|
||||
* by the process, i.e. remove the signal from the
|
||||
* temporary signalmask only if it wasn't already
|
||||
* in p_sigmask.
|
||||
*/
|
||||
@ -712,12 +710,13 @@ nfs_restore_sigmask(struct thread *td, sigset_t *set)
|
||||
* old one after msleep() returns.
|
||||
*/
|
||||
int
|
||||
nfs_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority, char *wmesg, int timo)
|
||||
nfs_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority,
|
||||
char *wmesg, int timo)
|
||||
{
|
||||
sigset_t oldset;
|
||||
int error;
|
||||
struct proc *p;
|
||||
|
||||
|
||||
if ((priority & PCATCH) == 0)
|
||||
return msleep(ident, mtx, priority, wmesg, timo);
|
||||
if (td == NULL)
|
||||
@ -738,7 +737,7 @@ nfs_sigintr(struct nfsmount *nmp, struct thread *td)
|
||||
{
|
||||
struct proc *p;
|
||||
sigset_t tmpset;
|
||||
|
||||
|
||||
/* Terminate all requests while attempting a forced unmount. */
|
||||
if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)
|
||||
return (EIO);
|
||||
@ -769,12 +768,11 @@ nfs_msg(struct thread *td, const char *server, const char *msg, int error)
|
||||
struct proc *p;
|
||||
|
||||
p = td ? td->td_proc : NULL;
|
||||
if (error) {
|
||||
if (error)
|
||||
tprintf(p, LOG_INFO, "nfs server %s: %s, error %d\n", server,
|
||||
msg, error);
|
||||
} else {
|
||||
else
|
||||
tprintf(p, LOG_INFO, "nfs server %s: %s\n", server, msg);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -793,7 +791,8 @@ nfs_down(struct nfsmount *nmp, struct thread *td, const char *msg,
|
||||
} else
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
mtx_lock(&nmp->nm_mtx);
|
||||
if ((flags & NFSSTA_LOCKTIMEO) && !(nmp->nm_state & NFSSTA_LOCKTIMEO)) {
|
||||
if ((flags & NFSSTA_LOCKTIMEO) &&
|
||||
!(nmp->nm_state & NFSSTA_LOCKTIMEO)) {
|
||||
nmp->nm_state |= NFSSTA_LOCKTIMEO;
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
vfs_event_signal(&nmp->nm_mountp->mnt_stat.f_fsid,
|
||||
@ -809,9 +808,8 @@ nfs_up(struct nfsmount *nmp, struct thread *td, const char *msg,
|
||||
{
|
||||
if (nmp == NULL)
|
||||
return;
|
||||
if (tprintfmsg) {
|
||||
if (tprintfmsg)
|
||||
nfs_msg(td, nmp->nm_mountp->mnt_stat.f_mntfromname, msg, 0);
|
||||
}
|
||||
|
||||
mtx_lock(&nmp->nm_mtx);
|
||||
if ((flags & NFSSTA_TIMEO) && (nmp->nm_state & NFSSTA_TIMEO)) {
|
||||
@ -821,9 +819,10 @@ nfs_up(struct nfsmount *nmp, struct thread *td, const char *msg,
|
||||
VQ_NOTRESP, 1);
|
||||
} else
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
|
||||
|
||||
mtx_lock(&nmp->nm_mtx);
|
||||
if ((flags & NFSSTA_LOCKTIMEO) && (nmp->nm_state & NFSSTA_LOCKTIMEO)) {
|
||||
if ((flags & NFSSTA_LOCKTIMEO) &&
|
||||
(nmp->nm_state & NFSSTA_LOCKTIMEO)) {
|
||||
nmp->nm_state &= ~NFSSTA_LOCKTIMEO;
|
||||
mtx_unlock(&nmp->nm_mtx);
|
||||
vfs_event_signal(&nmp->nm_mountp->mnt_stat.f_fsid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user