From 3a48bf73d3087bf6d40f119b491d718e6b7e8284 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 2 May 2010 13:56:24 -0400 Subject: [PATCH] Windows: add locked parameter to cm_noteLocalMountPointChange If cm_Freelance_Lock is held set the 'locked' parameter to TRUE. This avoids a requirement to drop the lock only to have it be obtained when cm_noteLocalMountPointChange. LICENSE MIT Change-Id: Ic1e8a008639b33769a088c3b24ef7a7e7b09fb12 Reviewed-on: http://gerrit.openafs.org/1887 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_freelance.c | 12 +++++++----- src/WINNT/afsd/cm_freelance.h | 2 +- src/WINNT/afsd/cm_ioctl.c | 4 ++-- src/WINNT/afsd/smb.c | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index 336cb5e147..7b3fac360f 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -75,7 +75,7 @@ void cm_FreelanceChangeNotifier(void * parmp) { hFreelanceChangeEvent = 0; return; } - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); } } } @@ -120,7 +120,7 @@ void cm_FreelanceSymlinkChangeNotifier(void * parmp) { hFreelanceSymlinkChangeEvent = 0; return; } - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); } } } @@ -358,11 +358,13 @@ int cm_FakeRootFid(cm_fid_t *fidp) /* called directly from ioctl */ /* called while not holding freelance lock */ -int cm_noteLocalMountPointChange(void) { - lock_ObtainMutex(&cm_Freelance_Lock); +int cm_noteLocalMountPointChange(afs_int32 locked) { + if (!locked) + lock_ObtainMutex(&cm_Freelance_Lock); cm_data.fakeDirVersion++; cm_localMountPointChangeFlag = 1; - lock_ReleaseMutex(&cm_Freelance_Lock); + if (!locked) + lock_ReleaseMutex(&cm_Freelance_Lock); return 1; } diff --git a/src/WINNT/afsd/cm_freelance.h b/src/WINNT/afsd/cm_freelance.h index 3b01684087..9a98064114 100644 --- a/src/WINNT/afsd/cm_freelance.h +++ b/src/WINNT/afsd/cm_freelance.h @@ -14,7 +14,7 @@ extern int cm_getLocalMountPointChange(); extern int cm_reInitLocalMountPoints(); extern void cm_InitFreelance(); extern void cm_FreelanceShutdown(void); -extern int cm_noteLocalMountPointChange(void); +extern int cm_noteLocalMountPointChange(afs_int32 locked); extern long cm_FreelanceRemoveMount(char *toremove); extern long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_fid_t *fidp); extern long cm_FreelanceRemoveSymlink(char *toremove); diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 7e3fb98d88..977d3d6f1b 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -95,7 +95,7 @@ cm_FlushFile(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp) #ifdef AFS_FREELANCE_CLIENT if ( scp->fid.cell == AFS_FAKE_ROOT_CELL_ID && scp->fid.volume == AFS_FAKE_ROOT_VOL_ID ) { - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); return 0; } #endif @@ -148,7 +148,7 @@ cm_FlushVolume(cm_user_t *userp, cm_req_t *reqp, afs_uint32 cell, afs_uint32 vol #ifdef AFS_FREELANCE_CLIENT if ( cell == AFS_FAKE_ROOT_CELL_ID && volume == AFS_FAKE_ROOT_VOL_ID ) { - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); return 0; } #endif diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 8a86680365..4130752bca 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -4075,7 +4075,7 @@ void smb_Daemon(void *parmp) #ifdef AFS_FREELANCE if ( smb_localZero != old_localZero ) - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); #endif smb_CheckVCs(); @@ -10661,7 +10661,7 @@ void smb_Init(osi_log_t *logp, int useV3, #ifdef AFS_FREELANCE_CLIENT /* Make sure the root.afs volume has the correct time */ - cm_noteLocalMountPointChange(); + cm_noteLocalMountPointChange(FALSE); #endif /* initialize the remote debugging log */