AFSFid tfid;
cm_callbackRequest_t cbr;
int mustCall;
- long sflags;
cm_fid_t sfid;
struct rx_connection * callp = NULL;
/* turn off mustCall, since it has now forced us past the check above */
mustCall = 0;
-#if 0
/* 20060929 jaltman - We are being called from within cm_SyncOp.
* if we call cm_SyncOp again and another thread has attempted
* to obtain current status CM_SCACHEFLAG_WAITING will be set
* and we will deadlock.
*/
/* otherwise, we have to make an RPC to get the status */
- sflags = CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK;
- cm_SyncOp(scp, NULL, userp, reqp, 0, sflags);
-#endif /* deadlock */
+ cm_SyncOp(scp, NULL, userp, reqp, 0,
+ CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK);
cm_StartCallbackGrantingCall(scp, &cbr);
sfid = scp->fid;
lock_ReleaseMutex(&scp->mx);
} else {
cm_EndCallbackGrantingCall(NULL, &cbr, NULL, 0);
}
-#if 0
/* 20060929 jaltman - don't deadlock */
- cm_SyncOpDone(scp, NULL, sflags);
-#endif
+ cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK);
/* now check to see if we got an error */
if (code) {
if (scp->flags & CM_SCACHEFLAG_DELETED) {
osi_Log4(afsd_logp, "Skipping BKG store - Deleted scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
- return;
- }
-
- cm_InitReq(&req);
+ } else {
+ cm_InitReq(&req);
#ifdef NO_BKG_RETRIES
- req.flags |= CM_REQ_NORETRY;
+ req.flags |= CM_REQ_NORETRY;
#endif
- toffset.LowPart = p1;
- toffset.HighPart = p2;
- length = p3;
+ toffset.LowPart = p1;
+ toffset.HighPart = p2;
+ length = p3;
- osi_Log4(afsd_logp, "Starting BKG store scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
+ osi_Log4(afsd_logp, "Starting BKG store scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
- code = cm_BufWrite(&scp->fid, &toffset, length, /* flags */ 0, userp, &req);
+ code = cm_BufWrite(&scp->fid, &toffset, length, /* flags */ 0, userp, &req);
+ }
lock_ObtainMutex(&scp->mx);
cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_ASYNCSTORE);
cm_scache_t *tscp;
int i;
+ lock_ObtainMutex(&scp->mx);
if (scp->flags & CM_SCACHEFLAG_INHASH) {
/* hash it out first */
i = CM_SCACHE_HASH(&scp->fid);
osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q);
osi_QDFree(qdp);
if (bufp) {
+ lock_ReleaseMutex(&scp->mx);
lock_ObtainMutex(&bufp->mx);
bufp->cmFlags &= ~CM_BUF_CMSTORING;
bufp->flags &= ~CM_BUF_DIRTY;
}
lock_ReleaseMutex(&bufp->mx);
buf_Release(bufp);
+ lock_ObtainMutex(&scp->mx);
}
}
while(qdp = scp->bufReadsp) {
osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q);
osi_QDFree(qdp);
if (bufp) {
+ lock_ReleaseMutex(&scp->mx);
lock_ObtainMutex(&bufp->mx);
bufp->cmFlags &= ~CM_BUF_CMFETCHING;
bufp->flags &= ~CM_BUF_DIRTY;
}
lock_ReleaseMutex(&bufp->mx);
buf_Release(bufp);
+ lock_ObtainMutex(&scp->mx);
}
}
buf_CleanDirtyBuffers(scp);
*/
cm_FreeAllACLEnts(scp);
+ osi_Wakeup((long)&scp->flags);
+
+ lock_ReleaseMutex(&scp->mx);
return 0;
}
lock_ObtainMutex(&scp->mx);
/* otherwise, we have to make an RPC to get the status */
code = cm_SyncOp(scp, NULL, userp, reqp, 0, CM_SCACHESYNC_STORESTATUS);
+ if (code) {
+ lock_ReleaseMutex(&scp->mx);
+ return code;
+ }
/* make the attr structure */
cm_StatusFromAttr(&afsInStatus, scp, attrp);
tfid.Vnode = scp->fid.vnode;
tfid.Unique = scp->fid.unique;
- lock_ReleaseMutex(&scp->mx);
- if (code)
- return code;
/* now make the RPC */
osi_Log1(afsd_logp, "CALL StoreStatus scp 0x%p", scp);
code = cm_Unlink(dscp, dep->name, rockp->userp, rockp->reqp);
if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
smb_NotifyChange(FILE_ACTION_REMOVED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, dep->name, NULL, TRUE);
if (code == 0) {
rockp->any = 1;
code = cm_RemoveDir(dscp, dep->name, rockp->userp, rockp->reqp);
if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
smb_NotifyChange(FILE_ACTION_REMOVED,
- FILE_NOTIFY_CHANGE_DIR_NAME,
+ FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, dep->name, NULL, TRUE);
if (code == 0)
rockp->any = 1;
scp->flags |= CM_SCACHEFLAG_DELETED;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_REMOVED,
- FILE_NOTIFY_CHANGE_DIR_NAME,
+ FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, fullPathp, NULL, TRUE);
}
} else {
scp->flags |= CM_SCACHEFLAG_DELETED;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_REMOVED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, fullPathp, NULL, TRUE);
}
}
created = 1;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_ADDED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, lastNamep, NULL, TRUE);
} else if (!excl && code == CM_ERROR_EXISTS) {
/* not an exclusive create, and someone else tried
created = 1;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_ADDED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, lastNamep, NULL, TRUE);
} else if (!excl && code == CM_ERROR_EXISTS) {
/* not an exclusive create, and someone else tried
created = 1;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_ADDED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, lastNamep, NULL, TRUE);
} else if (!excl && code == CM_ERROR_EXISTS) {
/* not an exclusive create, and someone else tried
if (createOptions & FILE_DELETE_ON_CLOSE)
fidflags |= SMB_FID_DELONCLOSE;
if (createOptions & FILE_SEQUENTIAL_ONLY && !(createOptions & FILE_RANDOM_ACCESS))
- fidflags | SMB_FID_SEQUENTIAL;
+ fidflags |= SMB_FID_SEQUENTIAL;
if (createOptions & FILE_RANDOM_ACCESS && !(createOptions & FILE_SEQUENTIAL_ONLY))
- fidflags & SMB_FID_RANDOM;
+ fidflags |= SMB_FID_RANDOM;
/* and the share mode */
if (shareAccess & FILE_SHARE_READ)
created = 1;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_ADDED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, lastNamep, NULL, TRUE);
} else if (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE) {
/* Not an exclusive create, and someone else tried
if (createOptions & FILE_DELETE_ON_CLOSE)
fidflags |= SMB_FID_DELONCLOSE;
if (createOptions & FILE_SEQUENTIAL_ONLY && !(createOptions & FILE_RANDOM_ACCESS))
- fidflags | SMB_FID_SEQUENTIAL;
+ fidflags |= SMB_FID_SEQUENTIAL;
if (createOptions & FILE_RANDOM_ACCESS && !(createOptions & FILE_SEQUENTIAL_ONLY))
- fidflags & SMB_FID_RANDOM;
+ fidflags |= SMB_FID_RANDOM;
/* And the share mode */
if (shareAccess & FILE_SHARE_READ)
created = 1;
if (dscp->flags & CM_SCACHEFLAG_ANYWATCH)
smb_NotifyChange(FILE_ACTION_ADDED,
- FILE_NOTIFY_CHANGE_FILE_NAME,
+ FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_CREATION,
dscp, lastNamep, NULL, TRUE);
} else if (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE) {
/* Not an exclusive create, and someone else tried