mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 07:51:00 +00:00
windows-optimize-smb-dir-search-if-no-wildcard-20061229
do not follow mountpoints when calling cm_Lookup as part of the optimization. otherwise the shortname is computed incorrectly.
This commit is contained in:
parent
224eb9ff60
commit
a305a8c3c7
@ -1474,7 +1474,7 @@ void smb_ReleaseFID(smb_fid_t *fidp)
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags &= ~CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
osi_Log2(afsd_logp,"smb_ReleaseFID fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReleaseFID fidp 0x%p scp 0x%p", fidp, scp);
|
||||
fidp->scp = NULL;
|
||||
}
|
||||
userp = fidp->userp;
|
||||
@ -1835,7 +1835,7 @@ void smb_DeleteDirSearch(smb_dirSearch_t *dsp)
|
||||
{
|
||||
lock_ObtainWrite(&smb_globalLock);
|
||||
lock_ObtainMutex(&dsp->mx);
|
||||
osi_Log3(afsd_logp,"smb_DeleteDirSearch cookie %d dsp 0x%p scp 0x%p",
|
||||
osi_Log3(smb_logp,"smb_DeleteDirSearch cookie %d dsp 0x%p scp 0x%p",
|
||||
dsp->cookie, dsp, dsp->scp);
|
||||
dsp->flags |= SMB_DIRSEARCH_DELETE;
|
||||
if (dsp->scp != NULL) {
|
||||
@ -1865,7 +1865,7 @@ void smb_ReleaseDirSearchNoLock(smb_dirSearch_t *dsp)
|
||||
lock_ReleaseMutex(&dsp->mx);
|
||||
lock_FinalizeMutex(&dsp->mx);
|
||||
scp = dsp->scp;
|
||||
osi_Log3(afsd_logp,"smb_ReleaseDirSearch cookie %d dsp 0x%p scp 0x%p",
|
||||
osi_Log3(smb_logp,"smb_ReleaseDirSearch cookie %d dsp 0x%p scp 0x%p",
|
||||
dsp->cookie, dsp, scp);
|
||||
free(dsp);
|
||||
} else {
|
||||
@ -2000,7 +2000,7 @@ smb_dirSearch_t *smb_NewDirSearch(int isV3)
|
||||
if (!smb_lastDirSearchp)
|
||||
smb_lastDirSearchp = (smb_dirSearch_t *) &dsp->q;
|
||||
|
||||
osi_Log2(afsd_logp,"smb_NewDirSearch cookie %d dsp 0x%p",
|
||||
osi_Log2(smb_logp,"smb_NewDirSearch cookie %d dsp 0x%p",
|
||||
dsp->cookie, dsp);
|
||||
break;
|
||||
}
|
||||
@ -3382,7 +3382,7 @@ void smb_WaitingLocksDaemon()
|
||||
wlRequest);
|
||||
|
||||
scp = wlRequest->scp;
|
||||
osi_Log2(afsd_logp,"smb_WaitingLocksDaemon wlRequest 0x%p scp 0x%p", wlRequest, scp);
|
||||
osi_Log2(smb_logp,"smb_WaitingLocksDaemon wlRequest 0x%p scp 0x%p", wlRequest, scp);
|
||||
|
||||
cm_InitReq(&req);
|
||||
|
||||
@ -3919,7 +3919,7 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou
|
||||
lock_ObtainMutex(&dsp->mx);
|
||||
if (dsp->scp) {
|
||||
scp = dsp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveCoreSearchDir (1) dsp 0x%p scp 0x%p", dsp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveCoreSearchDir (1) dsp 0x%p scp 0x%p", dsp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
code = 0;
|
||||
} else {
|
||||
@ -3951,7 +3951,7 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou
|
||||
#endif /* DFS_SUPPORT */
|
||||
|
||||
dsp->scp = scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveCoreSearchDir (2) dsp 0x%p scp 0x%p", dsp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveCoreSearchDir (2) dsp 0x%p scp 0x%p", dsp, scp);
|
||||
/* we need one hold for the entry we just stored into,
|
||||
* and one for our own processing. When we're done with this
|
||||
* function, we'll drop the one for our own processing.
|
||||
@ -4817,7 +4817,7 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
|
||||
/* save a pointer to the vnode */
|
||||
fidp->scp = scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveCoreOpen fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveCoreOpen fidp 0x%p scp 0x%p", fidp, scp);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags |= CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
@ -5175,7 +5175,7 @@ smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, char * oldPathp, char * newPathp, i
|
||||
code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&req,&tmpscp);
|
||||
if ((code != CM_ERROR_NOSUCHFILE) && (code != CM_ERROR_NOSUCHPATH) && (code != CM_ERROR_NOSUCHVOLUME) ) {
|
||||
osi_Log2(smb_logp, " lookup returns %ld for [%s]", code,
|
||||
osi_LogSaveString(afsd_logp, newLastNamep));
|
||||
osi_LogSaveString(smb_logp, newLastNamep));
|
||||
|
||||
/* Check if the old and the new names differ only in case. If so return
|
||||
* success, else return CM_ERROR_EXISTS
|
||||
@ -5364,7 +5364,7 @@ smb_Link(smb_vc_t *vcp, smb_packet_t *inp, char * oldPathp, char * newPathp)
|
||||
code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&req,&tmpscp);
|
||||
if ((code != CM_ERROR_NOSUCHFILE) && (code != CM_ERROR_NOSUCHPATH) && (code != CM_ERROR_NOSUCHVOLUME) ) {
|
||||
osi_Log2(smb_logp, " lookup returns %ld for [%s]", code,
|
||||
osi_LogSaveString(afsd_logp, newLastNamep));
|
||||
osi_LogSaveString(smb_logp, newLastNamep));
|
||||
|
||||
/* if the existing link is to the same file, then we return success */
|
||||
if (!code) {
|
||||
@ -7038,7 +7038,7 @@ long smb_ReceiveCoreCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
if (created)
|
||||
fidp->flags |= SMB_FID_CREATED;
|
||||
|
||||
osi_Log2(afsd_logp,"smb_ReceiveCoreCreate fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveCoreCreate fidp 0x%p scp 0x%p", fidp, scp);
|
||||
|
||||
/* save a pointer to the vnode */
|
||||
fidp->scp = scp;
|
||||
@ -8827,7 +8827,7 @@ void smb_Shutdown(void)
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags &= ~CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
osi_Log2(afsd_logp,"smb_Shutdown fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_Shutdown fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_ReleaseSCache(scp);
|
||||
}
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
|
@ -2358,7 +2358,7 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op)
|
||||
cm_HoldUser(userp);
|
||||
lock_ObtainMutex(&fidp->mx);
|
||||
/* save a pointer to the vnode */
|
||||
osi_Log2(afsd_logp,"smb_ReceiveTran2Open fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveTran2Open fidp 0x%p scp 0x%p", fidp, scp);
|
||||
fidp->scp = scp;
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags |= CM_SCACHEFLAG_SMB_FID;
|
||||
@ -3208,7 +3208,7 @@ long smb_ReceiveTran2QFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
|
||||
lock_ObtainMutex(&fidp->mx);
|
||||
delonclose = fidp->flags & SMB_FID_DELONCLOSE;
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReleaseTran2QFileInfo fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReleaseTran2QFileInfo fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
@ -3327,7 +3327,7 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet
|
||||
}
|
||||
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveTran2SetFileInfo fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveTran2SetFileInfo fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
|
||||
@ -4308,7 +4308,7 @@ long smb_T2SearchDirSingle(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op
|
||||
return 0;
|
||||
}
|
||||
#endif /* DFS_SUPPORT */
|
||||
osi_Log1(afsd_logp,"smb_ReceiveTran2SearchDir scp 0x%p", scp);
|
||||
osi_Log1(smb_logp,"smb_ReceiveTran2SearchDir scp 0x%p", scp);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0 &&
|
||||
LargeIntegerGreaterOrEqualToZero(scp->bulkStatProgress)) {
|
||||
@ -4317,12 +4317,12 @@ long smb_T2SearchDirSingle(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
|
||||
/* now do a single case sensitive lookup for the file in question */
|
||||
code = cm_Lookup(scp, maskp, 0, userp, &req, &targetscp);
|
||||
code = cm_Lookup(scp, maskp, CM_FLAG_NOMOUNTCHASE, userp, &req, &targetscp);
|
||||
|
||||
/* if a case sensitive match failed, we try a case insensitive one
|
||||
next. */
|
||||
if (code == CM_ERROR_NOSUCHFILE) {
|
||||
code = cm_Lookup(scp, maskp, CM_FLAG_CASEFOLD, userp, &req, &targetscp);
|
||||
code = cm_Lookup(scp, maskp, CM_FLAG_NOMOUNTCHASE | CM_FLAG_CASEFOLD, userp, &req, &targetscp);
|
||||
}
|
||||
|
||||
if (code == 0 && targetscp->fid.vnode == 0) {
|
||||
@ -4369,6 +4369,12 @@ long smb_T2SearchDirSingle(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op
|
||||
NeedShortName = 0;
|
||||
}
|
||||
|
||||
osi_Log4(smb_logp, "T2SDSingle dir vn %u uniq %u name %s (%s)",
|
||||
htonl(targetscp->fid.vnode),
|
||||
htonl(targetscp->fid.unique),
|
||||
osi_LogSaveString(smb_logp, pathp),
|
||||
NeedShortName ? osi_LogSaveString(smb_logp, shortName) : "");
|
||||
|
||||
/* Eliminate entries that don't match requested attributes */
|
||||
if (smb_hideDotFiles && !(attribute & SMB_ATTR_HIDDEN) &&
|
||||
smb_IsDotFile(maskp)) {
|
||||
@ -4737,7 +4743,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
|
||||
lock_ObtainMutex(&dsp->mx);
|
||||
if (dsp->scp) {
|
||||
scp = dsp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveTran2SearchDir dsp 0x%p scp 0x%p", dsp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveTran2SearchDir dsp 0x%p scp 0x%p", dsp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
code = 0;
|
||||
} else {
|
||||
@ -4776,7 +4782,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
|
||||
}
|
||||
#endif /* DFS_SUPPORT */
|
||||
dsp->scp = scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveTran2SearchDir dsp 0x%p scp 0x%p", dsp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveTran2SearchDir dsp 0x%p scp 0x%p", dsp, scp);
|
||||
/* we need one hold for the entry we just stored into,
|
||||
* and one for our own processing. When we're done
|
||||
* with this function, we'll drop the one for our own
|
||||
@ -5196,7 +5202,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
|
||||
* re-running the query.
|
||||
*/
|
||||
if (returnedNames == 0 && !starPattern && foundInexact) {
|
||||
osi_Log0(afsd_logp,"T2 Search: No exact matches. Re-running for inexact matches");
|
||||
osi_Log0(smb_logp,"T2 Search: No exact matches. Re-running for inexact matches");
|
||||
starPattern = 1;
|
||||
goto startsearch;
|
||||
}
|
||||
@ -5564,7 +5570,7 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags |= CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
osi_Log2(afsd_logp,"smb_ReceiveV3OpenX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveV3OpenX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
/* also the user */
|
||||
fidp->userp = userp;
|
||||
|
||||
@ -5680,7 +5686,7 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
return CM_ERROR_BADFD;
|
||||
}
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveV3LockingX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveV3LockingX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
|
||||
@ -5762,7 +5768,7 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
wlRequest->vcp = vcp;
|
||||
smb_HoldVC(vcp);
|
||||
wlRequest->scp = scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveV3LockingX wlRequest 0x%p scp 0x%p", wlRequest, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveV3LockingX wlRequest 0x%p scp 0x%p", wlRequest, scp);
|
||||
cm_HoldSCache(scp);
|
||||
wlRequest->inp = smb_CopyPacket(inp);
|
||||
wlRequest->outp = smb_CopyPacket(outp);
|
||||
@ -5921,7 +5927,7 @@ long smb_ReceiveV3GetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
|
||||
return CM_ERROR_BADFD;
|
||||
}
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveV3GetAttributes fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveV3GetAttributes fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
|
||||
@ -5998,7 +6004,7 @@ long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
|
||||
return CM_ERROR_BADFD;
|
||||
}
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveV3SetAttributes fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveV3SetAttributes fidp 0x%p scp 0x%p", fidp, scp);
|
||||
cm_HoldSCache(scp);
|
||||
lock_ReleaseMutex(&fidp->mx);
|
||||
|
||||
@ -7037,7 +7043,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags |= CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
osi_Log2(afsd_logp,"smb_ReceiveNTCreateX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveNTCreateX fidp 0x%p scp 0x%p", fidp, scp);
|
||||
|
||||
fidp->flags = fidflags;
|
||||
|
||||
@ -7047,7 +7053,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
|
||||
/* save parent dir and pathname for delete or change notification */
|
||||
if (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE)) {
|
||||
osi_Log2(afsd_logp,"smb_ReceiveNTCreateX fidp 0x%p dscp 0x%p", fidp, dscp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveNTCreateX fidp 0x%p dscp 0x%p", fidp, dscp);
|
||||
fidp->flags |= SMB_FID_NTOPEN;
|
||||
fidp->NTopen_dscp = dscp;
|
||||
dscp = NULL;
|
||||
@ -7678,7 +7684,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
scp->flags |= CM_SCACHEFLAG_SMB_FID;
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
osi_Log2(afsd_logp,"smb_ReceiveNTTranCreate fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveNTTranCreate fidp 0x%p scp 0x%p", fidp, scp);
|
||||
|
||||
fidp->flags = fidflags;
|
||||
|
||||
@ -7690,7 +7696,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
|
||||
if (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE)) {
|
||||
fidp->flags |= SMB_FID_NTOPEN;
|
||||
fidp->NTopen_dscp = dscp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveNTTranCreate fidp 0x%p dscp 0x%p", fidp, dscp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveNTTranCreate fidp 0x%p dscp 0x%p", fidp, dscp);
|
||||
dscp = NULL;
|
||||
fidp->NTopen_pathp = strdup(lastNamep);
|
||||
}
|
||||
@ -7858,7 +7864,7 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp,
|
||||
lock_ReleaseMutex(&smb_Dir_Watch_Lock);
|
||||
|
||||
scp = fidp->scp;
|
||||
osi_Log3(afsd_logp,"smb_ReceiveNTTranNotifyChange fidp 0x%p scp 0x%p file \"%s\"",
|
||||
osi_Log3(smb_logp,"smb_ReceiveNTTranNotifyChange fidp 0x%p scp 0x%p file \"%s\"",
|
||||
fidp, scp, osi_LogSaveString(smb_logp, fidp->NTopen_wholepathp));
|
||||
osi_Log3(smb_logp, "Request for NotifyChange filter 0x%x fid %d wtree %d",
|
||||
filter, fid, watchtree);
|
||||
@ -8277,7 +8283,7 @@ long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
|
||||
osi_LogSaveString(smb_logp, (fidp)?fidp->NTopen_wholepathp:""));
|
||||
|
||||
scp = fidp->scp;
|
||||
osi_Log2(afsd_logp,"smb_ReceiveNTCancel fidp 0x%p scp 0x%p", fidp, scp);
|
||||
osi_Log2(smb_logp,"smb_ReceiveNTCancel fidp 0x%p scp 0x%p", fidp, scp);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (watchtree)
|
||||
scp->flags &= ~CM_SCACHEFLAG_WATCHEDSUBTREE;
|
||||
|
Loading…
Reference in New Issue
Block a user