Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsclient/nfs_clport.c
Show First 20 Lines • Show All 1,140 Lines • ▼ Show 20 Lines | union { | ||||
u_int32_t lval; | u_int32_t lval; | ||||
u_int8_t cval[4]; | u_int8_t cval[4]; | ||||
} tl; | } tl; | ||||
struct proc *p; | struct proc *p; | ||||
pid_t pid; | pid_t pid; | ||||
int i, ret = 0; | int i, ret = 0; | ||||
/* For the single open_owner of all 0 bytes, just return 0. */ | /* For the single open_owner of all 0 bytes, just return 0. */ | ||||
for (i = 0; i < NFSV4CL_LOCKNAMELEN; i++) | for (i = 0; i < NFSV4CL_LOCKNAMELEN; i++) | ||||
mjg: This check is an optimization to avoid locking in certain cases. It is harmful for this… | |||||
Done Inline ActionsGone, since the stable/12 pfind_locked() doesn't have it. rmacklem: Gone, since the stable/12 pfind_locked() doesn't have it.
| |||||
if (own[i] != 0) | if (own[i] != 0) | ||||
break; | break; | ||||
if (i == NFSV4CL_LOCKNAMELEN) | if (i == NFSV4CL_LOCKNAMELEN) | ||||
return (0); | return (0); | ||||
Not Done Inline ActionsThe process may be a zombie in which case you probably also want to fail to find it. mjg: The process may be a zombie in which case you probably also want to fail to find it. | |||||
Done Inline ActionsAs explained in the main comment, the old code (which is what is now rmacklem: As explained in the main comment, the old code (which is what is now
back in kern_proc.c) does… | |||||
tl.cval[0] = *own++; | tl.cval[0] = *own++; | ||||
tl.cval[1] = *own++; | tl.cval[1] = *own++; | ||||
tl.cval[2] = *own++; | tl.cval[2] = *own++; | ||||
tl.cval[3] = *own++; | tl.cval[3] = *own++; | ||||
pid = tl.lval; | pid = tl.lval; | ||||
p = pfind(pid); | p = pfind_any_locked(pid); | ||||
if (p == NULL) | if (p == NULL) | ||||
return (1); | return (1); | ||||
if (p->p_stats == NULL) { | if (p->p_stats == NULL) { | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
return (0); | return (0); | ||||
} | } | ||||
tl.cval[0] = *own++; | tl.cval[0] = *own++; | ||||
tl.cval[1] = *own++; | tl.cval[1] = *own++; | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
This check is an optimization to avoid locking in certain cases. It is harmful for this consumer where the check will always be false and locks are taken anyway.