#include "afs/lock.h"
#include "afs/afs_cbqueue.h"
-#ifdef AFS_DISCON_ENV
-
#define dv_match(vc, fstat) \
((vc->f.m.DataVersion.low == fstat.DataVersion) && \
(vc->f.m.DataVersion.high == fstat.dataVersionHigh))
if (tnf.name_len == -1)
code = ENOENT;
} else {
- printf("Directory dcache not found!\n");
+ /* printf("Directory dcache not found!\n"); */
code = ENOENT;
}
static int
list_dir_hook(void *hdata, char *aname, afs_int32 vnode, afs_int32 unique)
{
- printf("list_dir_hook: %s v:%u u:%u\n", aname, vnode, unique);
+ /* printf("list_dir_hook: %s v:%u u:%u\n", aname, vnode, unique); */
return 0;
}
*adp = NULL;
if (afs_GetParentDirFid(avc, afid)) {
- printf("afs_GetParentVCache: Couldn't find parent dir's FID.\n");
+ /* printf("afs_GetParentVCache: Couldn't find parent dir's FID.\n"); */
return ENOENT;
}
code = afs_GetVnodeName(avc, afid, aname, deleted);
if (code) {
- printf("afs_GetParentVCache: Couldn't find file name\n");
+ /* printf("afs_GetParentVCache: Couldn't find file name\n"); */
goto end;
}
*adp = afs_FindVCache(afid, 0, 1);
ReleaseSharedLock(&afs_xvcache);
if (!*adp) {
- printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n");
+ /* printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n"); */
code = ENOENT;
goto end;
}
if ((*adp)->f.ddirty_flags & VDisconCreate) {
- printf("afs_GetParentVCache: deferring until parent exists\n");
+ /* printf("afs_GetParentVCache: deferring until parent exists\n"); */
code = EAGAIN;
goto end;
}
end:
- if (code && *adp)
+ if (code && *adp) {
afs_PutVCache(*adp);
+ *adp = NULL;
+ }
return code;
}
/* Get old name. */
old_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
if (!old_name) {
- printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n"); */
return ENOMEM;
}
code = afs_GetVnodeName(avc, &old_pdir_fid, old_name, 1);
if (code) {
- printf("afs_ProcessOpRename: Couldn't find old name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find old name.\n"); */
goto done;
}
/* Alloc data first. */
new_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
if (!new_name) {
- printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n"); */
code = ENOMEM;
goto done;
}
} else {
/* Get parent dir's FID.*/
if (afs_GetParentDirFid(avc, &new_pdir_fid)) {
- printf("afs_ProcessOpRename: Couldn't find new parent dir FID.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find new parent dir FID.\n"); */
code = ENOENT;
goto done;
}
/* And finally get the new name. */
code = afs_GetVnodeName(avc, &new_pdir_fid, new_name, 0);
if (code) {
- printf("afs_ProcessOpRename: Couldn't find new name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find new name.\n"); */
goto done;
}
SHARED_LOCK,
NULL));
- if (code)
- printf("afs_ProcessOpRename: server code=%u\n", code);
+ /* if (code) printf("afs_ProcessOpRename: server code=%u\n", code); */
done:
if (new_name)
afs_osi_Free(new_name, AFSNAMEMAX);
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE | AFS_SETGROUP;
InStatus.ClientModTime = avc->f.m.Date;
InStatus.Owner = avc->f.m.Owner;
- InStatus.Group = (afs_int32) acred->cr_gid;
+ InStatus.Group = (afs_int32) afs_cr_gid(acred);
/* Only care about protection bits. */
InStatus.UnixModeBits = avc->f.m.Mode & 0xffff;
/* TODO: Handle errors. */
if (code) {
- printf("afs_ProcessOpCreate: error while creating vnode on server, code=%d .\n", code);
+ /* printf("afs_ProcessOpCreate: error while creating vnode on server, code=%d .\n", code); */
goto end;
}
tname = afs_osi_Alloc(AFSNAMEMAX);
if (!tname) {
- printf("afs_ProcessOpRemove: Couldn't alloc space for file name\n");
+ /* printf("afs_ProcessOpRemove: Couldn't alloc space for file name\n"); */
return ENOMEM;
}
} /* if (vType(avc) == VREG) */
- if (code)
- printf("afs_ProcessOpRemove: server returned code=%u\n", code);
+ /* if (code) printf("afs_ProcessOpRemove: server returned code=%u\n", code); */
end:
afs_osi_Free(tname, AFSNAMEMAX);
afs_ResetVCache(tvc, acred);
tvc->f.truncPos = AFS_NOTRUNC;
} else {
- printf("afs_ResyncDisconFiles: no resolution policy selected.\n");
+ /* printf("afs_ResyncDisconFiles: no resolution policy selected.\n"); */
} /* if DV match or client wins policy */
unlock_srv_file:
*/
static void
-afs_DisconDiscardAllShadows(int squash, afs_ucred_t *acred) {
+afs_DisconDiscardAllShadows(int squash, afs_ucred_t *acred)
+{
struct vcache *tvc;
while (!QEmpty(&afs_disconShadow)) {
ReleaseWriteLock(&afs_disconDirtyLock);
ObtainWriteLock(&tvc->lock, 706);
- afs_DeleteShadowDir(tvc);
- tvc->f.shadow.vnode = 0;
- tvc->f.shadow.unique = 0;
-
if (squash)
afs_ResetVCache(tvc, acred);
+ afs_DeleteShadowDir(tvc);
+
ReleaseWriteLock(&tvc->lock);
ObtainWriteLock(&afs_disconDirtyLock, 709);
} /* while (tvc) */
*
*/
void
-afs_DisconDiscardAll(afs_ucred_t *acred) {
+afs_DisconDiscardAll(afs_ucred_t *acred)
+{
struct vcache *tvc;
ObtainWriteLock(&afs_disconDirtyLock, 717);
while (!QEmpty(&afs_disconDirty)) {
tvc = QEntry(QPrev(&afs_disconDirty), struct vcache, dirtyq);
+ QRemove(&tvc->dirtyq);
ReleaseWriteLock(&afs_disconDirtyLock);
ObtainWriteLock(&tvc->lock, 718);
afs_ResetVCache(tvc, acred);
tvc->f.truncPos = AFS_NOTRUNC;
ReleaseWriteLock(&tvc->lock);
- afs_PutVCache(tvc);
ObtainWriteLock(&afs_disconDirtyLock, 719);
+ afs_PutVCache(tvc);
}
afs_DisconDiscardAllShadows(1, acred);
struct afs_q *q;
int i = 0;
- printf("List of dirty files: \n");
+ afs_warn("List of dirty files: \n");
ObtainReadLock(&afs_disconDirtyLock);
for (q = QPrev(&afs_disconDirty); q != &afs_disconDirty; q = QPrev(q)) {
tvc = QEntry(q, struct vcache, dirtyq);
- printf("Cell=%u Volume=%u VNode=%u Unique=%u\n",
+ afs_warn("Cell=%u Volume=%u VNode=%u Unique=%u\n",
tvc->f.fid.Cell,
tvc->f.fid.Fid.Volume,
tvc->f.fid.Fid.Vnode,
avc->f.states |= CStatd;
avc->f.states &= ~CBulkFetching;
}
-#endif