windows-invalidate-file-locks-vnovnode-20080217

LICENSE MIT

Upon receiving a VNOVNODE error from a file server, be sure to
invalidate any file locks.  This prevents on-going attempts to
extend the locks and will cause subsequent attempts to access
the file to receive a invalid handle error.
This commit is contained in:
Jeffrey Altman 2008-02-17 05:58:13 +00:00
parent 33bed62961
commit 38c2524bd1
3 changed files with 7 additions and 6 deletions

View File

@ -514,6 +514,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
lock_ObtainWrite(&cm_scacheLock);
cm_RemoveSCacheFromHashTable(scp);
lock_ReleaseWrite(&cm_scacheLock);
cm_LockMarkSCacheLost(scp);
scp->flags |= CM_SCACHEFLAG_DELETED;
lock_ReleaseMutex(&scp->mx);
cm_ReleaseSCache(scp);

View File

@ -3957,9 +3957,6 @@ long cm_LockCheckWrite(cm_scache_t *scp,
#endif
}
/* Forward dcl. */
static void cm_LockMarkSCacheLost(cm_scache_t * scp);
/* Called with cm_scacheLock write locked */
static cm_file_lock_t * cm_GetFileLock(void) {
cm_file_lock_t * l;
@ -4905,7 +4902,7 @@ long cm_Unlock(cm_scache_t *scp,
}
/* called with scp->mx held */
static void cm_LockMarkSCacheLost(cm_scache_t * scp)
void cm_LockMarkSCacheLost(cm_scache_t * scp)
{
cm_file_lock_t *fileLock;
osi_queue_t *q;
@ -5029,7 +5026,7 @@ void cm_CheckLocks()
if (!IS_LOCK_ACTIVE(fileLock))
goto pre_syncopdone;
if (scp->serverLock != -1) {
if (scp->serverLock != -1 && !(scp->flags & CM_SCACHEFLAG_DELETED)) {
cm_fid_t cfid;
cm_user_t * userp;
@ -5106,7 +5103,8 @@ void cm_CheckLocks()
}
}
if (code == EINVAL || code == CM_ERROR_INVAL) {
if (code == EINVAL || code == CM_ERROR_INVAL ||
code == CM_ERROR_BADFD) {
cm_LockMarkSCacheLost(scp);
}

View File

@ -224,6 +224,8 @@ extern void cm_CheckLocks(void);
extern void cm_ReleaseAllLocks(void);
extern void cm_LockMarkSCacheLost(cm_scache_t * scp);
extern long cm_RetryLock(cm_file_lock_t *oldFileLock, int client_is_dead);
#define CM_SESSION_SMB 0xffff