DEVEL15-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.


(cherry picked from commit 38c2524bd16f1e535ea28f9d0788b7eaa8d26c3d)
This commit is contained in:
Jeffrey Altman 2008-02-17 05:59:30 +00:00
parent 0582ea3bca
commit e64053d95f
3 changed files with 18 additions and 14 deletions

View File

@ -459,17 +459,19 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
break;
}
/* Log server being offline for this volume */
sprintf(addr, "%d.%d.%d.%d",
((serverp->addr.sin_addr.s_addr & 0xff)),
((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
if (serverp && fidp) {
/* Log server being offline for this volume */
sprintf(addr, "%d.%d.%d.%d",
((serverp->addr.sin_addr.s_addr & 0xff)),
((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume);
LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume);
#endif
}
/* Mark server offline for this volume */
if (!serversp && fidp) {
@ -479,6 +481,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
free_svr_list = 1;
}
}
lock_ObtainWrite(&cm_serverLock);
for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
if (tsrp->server == serverp) {
@ -538,6 +541,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

@ -3959,9 +3959,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;
@ -4907,7 +4904,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;
@ -5031,7 +5028,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;
@ -5108,7 +5105,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