MessageBox(NULL, tbuffer, msgp, MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
afsd_ForceTrace(TRUE);
+ buf_ForceTrace(TRUE);
if (traceOnPanic) {
_asm int 3h;
/*MessageBox(NULL, tbuffer, msgp, MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);*/
afsd_ForceTrace(TRUE);
+ buf_ForceTrace(TRUE);
if (traceOnPanic) {
/*asm("int 3");*/
osi_LogEnable(afsd_logp);
afsd_ForceTrace(TRUE);
+ buf_ForceTrace(TRUE);
afsi_log("--- begin dump ---");
cm_DumpSCache(afsi_file, "a");
RegCloseKey (parmKey);
if (code != ERROR_SUCCESS)
doTrace = 0;
- if (doTrace)
+ if (doTrace) {
afsd_ForceTrace(FALSE);
+ buf_ForceTrace(FALSE);
+ }
doneTrace:
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
RegCloseKey (parmKey);
if (code != ERROR_SUCCESS)
doTrace = 0;
- if (doTrace)
+ if (doTrace) {
afsd_ForceTrace(FALSE);
+ buf_ForceTrace(FALSE);
+ }
doneTrace:
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
#include <malloc.h>
#include <stdio.h>
#include <assert.h>
+#include <strsafe.h>
#include "afsd.h"
+#ifdef DEBUG
+#define TRACE_BUFFER 1
+#endif
+
extern void afsi_log(char *pattern, ...);
/* This module implements the buffer package used by the local transaction
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
+ FreeCacheFileSA(psa);
if (hf == INVALID_HANDLE_VALUE) {
afsi_log("Error creating cache file \"%s\" error %d",
cm_CachePath, GetLastError());
return CM_ERROR_INVAL;
}
- FreeCacheFileSA(psa);
} else { /* buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL */
hf = INVALID_HANDLE_VALUE;
}
/* just for safety's sake */
buf_maxReservedBufs = buf_nbuffers - 3;
+#ifdef TRACE_BUFFER
/* init the buffer trace log */
- buf_logp = osi_LogCreate("buffer", 10);
+ buf_logp = osi_LogCreate("buffer", 1000);
+ osi_LogEnable(buf_logp);
+#endif
osi_EndOnce(&once);
bp->flags |= CM_BUF_WAITING;
osi_SleepM((long) bp, &bp->mx);
lock_ObtainMutex(&bp->mx);
- osi_Log1(buf_logp, "buf_WaitIO conflict wait done for 0x%x", bp);
+ osi_Log1(buf_logp, "buf_WaitIO conflict wait done for 0x%x", bp);
}
/* if we get here, the IO is done, but we may have to wakeup people waiting for
return 0;
}
+void buf_ForceTrace(BOOL flush)
+{
+ HANDLE handle;
+ int len;
+ char buf[256];
+
+ if (!buf_logp)
+ return;
+
+ len = GetTempPath(sizeof(buf)-10, buf);
+ StringCbCopyA(&buf[len], sizeof(buf)-len, "/afs-buffer.log");
+ handle = CreateFile(buf, GENERIC_WRITE, FILE_SHARE_READ,
+ NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (handle == INVALID_HANDLE_VALUE) {
+ osi_panic("Cannot create log file", __FILE__, __LINE__);
+ }
+ osi_LogPrint(buf_logp, handle);
+ if (flush)
+ FlushFileBuffers(handle);
+ CloseHandle(handle);
+}
extern long buf_SetNBuffers(long nbuffers);
+extern void buf_ForceTrace(BOOL flush);
+
/* error codes */
#define CM_BUF_EXISTS 1 /* buffer exists, and shouldn't */
#define CM_ERROR_BASEBUF 0x33333333
/* print trace */
if (inValue & 8) {
afsd_ForceTrace(FALSE);
+ buf_ForceTrace(FALSE);
}
if (inValue & 2) {
* Iterate through all entries in a directory.
* When the function funcp is called, the buffer is locked but the
* directory vnode is not.
+ *
+ * If the retscp parameter is not NULL, the parmp must be a
+ * cm_lookupSearch_t object.
*/
long cm_ApplyDir(cm_scache_t *scp, cm_DirFuncp_t funcp, void *parmp,
osi_hyper_t *startOffsetp, cm_user_t *userp, cm_req_t *reqp,
if (retscp) /* if this is a lookup call */
{
cm_lookupSearch_t* sp = parmp;
- int casefold = sp->caseFold;
-
- sp->caseFold = 0; /* we have a strong preference for exact matches */
- if ( *retscp = cm_dnlcLookup(scp, sp)) /* dnlc hit */
- {
- sp->caseFold = casefold;
- lock_ReleaseMutex(&scp->mx);
- return 0;
- }
- sp->caseFold = casefold;
+#ifdef AFS_FREELANCE_CLIENT
+ /* Freelance entries never end up in the DNLC because they
+ * do not have an associated cm_server_t
+ */
+ if ( !(cm_freelanceEnabled &&
+ sp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
+ sp->fid.volume==AFS_FAKE_ROOT_VOL_ID ) )
+#endif /* AFS_FREELANCE_CLIENT */
+ {
+ int casefold = sp->caseFold;
+ sp->caseFold = 0; /* we have a strong preference for exact matches */
+ if ( *retscp = cm_dnlcLookup(scp, sp)) /* dnlc hit */
+ {
+ sp->caseFold = casefold;
+ lock_ReleaseMutex(&scp->mx);
+ return 0;
+ }
+ sp->caseFold = casefold;
+ }
}
/*
int sysNameIndex = 0;
cm_scache_t *scp = 0;
+ if ( stricmp(namep,SMB_IOCTL_FILENAME_NOSLASH) == 0 ) {
+ if (flags & CM_FLAG_CHECKPATH)
+ return CM_ERROR_NOSUCHPATH;
+ else
+ return CM_ERROR_NOSUCHFILE;
+ }
+
for ( sysNameIndex = 0; sysNameIndex < MAXNUMSYSNAMES; sysNameIndex++) {
code = cm_ExpandSysName(namep, tname, sizeof(tname), sysNameIndex);
if (code > 0) {
bb.counter = 0;
bb.bufOffset = *offsetp;
- lock_ReleaseMutex(&dscp->mx);
+ lock_ReleaseMutex(&dscp->mx);
/* first, assemble the file IDs we need to stat */
- code = cm_ApplyDir(dscp, cm_TryBulkProc, (void *) &bb, offsetp, userp,
- reqp, NULL);
- lock_ObtainMutex(&dscp->mx);
+ code = cm_ApplyDir(dscp, cm_TryBulkProc, (void *) &bb, offsetp, userp, reqp, NULL);
+ lock_ObtainMutex(&dscp->mx);
/* if we failed, bail out early */
if (code && code != CM_ERROR_STOPNOW) return;
{
int matchType = 0;
smb_findShare_rock_t * vrock = (smb_findShare_rock_t *) rockp;
- if(!strnicmp(dep->name, vrock->shareName, 12)) {
+ if (!strnicmp(dep->name, vrock->shareName, 12)) {
if(!stricmp(dep->name, vrock->shareName))
matchType = SMB_FINDSHARE_EXACT_MATCH;
else
(uidp? (uidp->unp ? uidp->unp->userp : NULL) : NULL), &req, NULL);
cm_ReleaseSCache(cm_rootSCachep);
- if(vrock.matchType) {
+ if (vrock.matchType) {
sprintf(pathName,"/%s/",vrock.match);
*pathNamep = strdup(strlwr(pathName));
free(vrock.match);
rock.name = pathp;
rock.vnode = scp;
- code = cm_ApplyDir(dscp, smb_FullNameProc, &rock, NULL,
- userp, reqp, NULL);
+ code = cm_ApplyDir(dscp, smb_FullNameProc, &rock, NULL, userp, reqp, NULL);
if (code == CM_ERROR_STOPNOW)
*newPathp = rock.fullName;
else
}
afsd_ForceTrace(TRUE);
+ buf_ForceTrace(TRUE);
return EXCEPTION_CONTINUE_SEARCH;
}
#endif
rock.shortName = shortName;
rock.vnode = vnode;
rock.maskp = lastNamep;
- code = cm_ApplyDir(dscp, cm_GetShortNameProc, &rock, &thyper, userp,
- reqp, NULL);
+ code = cm_ApplyDir(dscp, cm_GetShortNameProc, &rock, &thyper, userp, reqp, NULL);
cm_ReleaseSCache(dscp);