if ((code = afs_InitReq(&treq, acred)))
return code;
+ AFS_DISCON_LOCK();
+
if (afs_fakestat_enable && avc->mvstat == 1) {
code = afs_TryEvalFakeStat(&avc, &fakestate, &treq);
if (code == 0 && avc->mvstat == 1) {
afs_PutFakeStat(&fakestate);
+ AFS_DISCON_UNLOCK();
return 0;
}
} else {
if (code) {
afs_PutFakeStat(&fakestate);
+ AFS_DISCON_UNLOCK();
return code;
}
code = afs_VerifyVCache(avc, &treq);
if (code) {
afs_PutFakeStat(&fakestate);
+ AFS_DISCON_UNLOCK();
code = afs_CheckCode(code, &treq, 16);
return code;
}
/* if we're looking for write access and we have a read-only file system, report it */
if ((amode & VWRITE) && (avc->states & CRO)) {
afs_PutFakeStat(&fakestate);
+ AFS_DISCON_UNLOCK();
return EROFS;
}
+
+ /* If we're looking for write access, and we're disconnected without logging, forget it */
+ if ((amode & VWRITE) && (AFS_IS_DISCONNECTED && !AFS_IS_LOGGING)) {
+ afs_PutFakeStat(&fakestate);
+ AFS_DISCON_UNLOCK();
+ /*printf("Network is down in afs_vnop_access\n");*/
+ return ENETDOWN;
+ }
+
code = 1; /* Default from here on in is access ok. */
if (avc->states & CForeign) {
/* In the dfs xlator the EXEC bit is mapped to LOOKUP */
}
}
afs_PutFakeStat(&fakestate);
+
+ AFS_DISCON_UNLOCK();
+
if (code) {
return 0; /* if access is ok */
} else {