#ifdef AFS_OSF_ENV
int acmd = 0;
#endif
+ struct afs_fakestat_state fakestate;
AFS_STATCNT(afs_lockctl);
if (code = afs_InitReq(&treq, acred)) return code;
+ afs_InitFakeStat(&fakestate);
+ code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+ if (code) {
+ afs_PutFakeStat(&fakestate);
+ return code;
+ }
#ifdef AFS_OSF_ENV
- if (flag & VNOFLCK) return 0;
+ if (flag & VNOFLCK) {
+ afs_PutFakeStat(&fakestate);
+ return 0;
+ }
if (flag & CLNFLCK) {
acmd = LOCK_UN;
} else if ((flag & GETFLCK) || (flag & RGETFLCK)) {
#else
if (acmd == F_GETLK) {
#endif
- if (af->l_type == F_UNLCK)
+ if (af->l_type == F_UNLCK) {
+ afs_PutFakeStat(&fakestate);
return 0;
+ }
#ifndef AFS_OSF_ENV /* getlock is a no-op for osf (for now) */
code = HandleGetLock(avc, af, &treq, clid);
#endif
code = afs_CheckCode(code, &treq, 2); /* defeat buggy AIX optimz */
+ afs_PutFakeStat(&fakestate);
return code;
}
else if ((acmd == F_SETLK) || (acmd == F_SETLKW)
even when they should block */
if (af->l_whence != 0 || af->l_start != 0 || af->l_len != 0) {
DoLockWarning();
+ afs_PutFakeStat(&fakestate);
return 0;
}
/* otherwise we can turn this into a whole-file flock */
if (af->l_type == F_RDLCK) code = LOCK_SH;
else if (af->l_type == F_WRLCK) code = LOCK_EX;
else if (af->l_type == F_UNLCK) code = LOCK_UN;
- else return EINVAL; /* unknown lock type */
+ else {
+ afs_PutFakeStat(&fakestate);
+ return EINVAL; /* unknown lock type */
+ }
if (((acmd == F_SETLK)
#if (defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV)) && !defined(AFS_SUN58_ENV)
|| (acmd == F_RSETLK)
#endif
#endif
code = afs_CheckCode(code, &treq, 3); /* defeat AIX -O bug */
+ afs_PutFakeStat(&fakestate);
return code;
}
+ afs_PutFakeStat(&fakestate);
return EINVAL;
}
struct vrequest treq;
struct vcache *tvc;
int flockDone;
+ struct afs_fakestat_state fakestate;
+ afs_InitFakeStat(&fakestate);
AFS_STATCNT(afs_xflock);
flockDone = 0;
#ifdef AFS_OSF_ENV
uap = (struct a *)u.u_ap;
fd = getf(uap->fd);
#endif
- if (!fd) return;
+ if (!fd) {
+ afs_PutFakeStat(&fakestate);
+ return;
+ }
- if (flockDone = afs_InitReq(&treq, u.u_cred)) return flockDone;
+ if (flockDone = afs_InitReq(&treq, u.u_cred)) {
+ afs_PutFakeStat(&fakestate);
+ return flockDone;
+ }
/* first determine whether this is any sort of vnode */
if (fd->f_type == DTYPE_VNODE) {
/* good, this is a vnode; next see if it is an AFS vnode */
- tvc = (struct vcache *) fd->f_data; /* valid, given a vnode */
- if (IsAfsVnode((struct vnode *)tvc)) {
+ tvc = VTOAFS(fd->f_data); /* valid, given a vnode */
+ if (IsAfsVnode(AFSTOV(tvc))) {
/* This is an AFS vnode, so do the work */
#ifdef AFS_DEC_ENV
/* find real vcache entry; shouldn't be null if gnode ref count
* is greater than 0.
*/
- tvc = (struct vcache *) afs_gntovn(tvc);
+ tvc = VTOAFS(afs_gntovn)(tvc);
if (!tvc) {
u.u_error = ENOENT;
+ afs_PutFakeStat(&fakestate);
return;
}
#endif
+ code = afs_EvalFakeStat(&tvc, &fakestate, &treq);
+ if (code) {
+ afs_PutFakeStat(&fakestate);
+ return code;
+ }
if ((fd->f_flag & (FEXLOCK | FSHLOCK)) && !(uap->com & LOCK_UN)) {
/* First, if fd already has lock, release it for relock path */
#if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV))
#else
FP_UNREF(fd);
#endif
+ afs_PutFakeStat(&fakestate);
return code;
#else /* AFS_OSF_ENV */
if (!flockDone)
#else
flock();
#endif
+ afs_PutFakeStat(&fakestate);
return;
#endif
}