static void xixfs_put_super( struct super_block *sb ) { int RC = 0; PXIXFS_LINUX_VCB pVCB = NULL; PXIXFS_LINUX_META_CTX pCtx = NULL; PXIXCORE_META_CTX pXixcoreCtx = NULL; #if LINUX_VERSION_25_ABOVE int TimeOut = 0; #endif XIXCORE_ASSERT(sb); pVCB = XIXFS_SB(sb); XIXFS_ASSERT_VCB(pVCB); pCtx = &(pVCB->MetaCtx); pXixcoreCtx = &pVCB->XixcoreVcb.MetaContext; XIXCORE_ASSERT(pCtx); DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VFSAPIT|DEBUG_TARGET_VCB), ("Enter xixfs_put_super\n")); xixcore_CleanUpAuxLotLockInfo(&pVCB->XixcoreVcb); if(pVCB->XixcoreVcb.IsVolumeWriteProtected != 1) { #if !LINUX_VERSION_25_ABOVE XIXFS_WAIT_CTX wait; #endif DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_ALL, ("!!request Meta thread stop \n")); spin_lock(&(pCtx->MetaLock)); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK, ("spin_lock(&(pCtx->MetaLock)) pCtx(%p)\n", pCtx)); XIXCORE_SET_FLAGS(pXixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_KILL_THREAD); spin_unlock(&(pCtx->MetaLock)); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK, ("spin_unlock(&(pCtx->MetaLock)) pCtx(%p)\n", pCtx)); #if !LINUX_VERSION_25_ABOVE xixfs_init_wait_ctx(&wait); xixfs_add_metaThread_stop_wait_list(&wait, pCtx); #endif wake_up(&(pCtx->VCBMetaEvent)); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_THREAD, ("META THREAD STOP REQ\n")); #if LINUX_VERSION_25_ABOVE TimeOut = DEFAULT_XIXFS_UMOUNTWAIT; RC = wait_for_completion_timeout(&(pCtx->VCBMetaThreadStopCompletion), TimeOut); INIT_COMPLETION(pCtx->VCBMetaThreadStopCompletion); #else wait_for_completion(&(wait.WaitCompletion)); #endif DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_THREAD, ("END META THREAD STOP REQ\n")); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_ALL, ("!!replyed Meta thread stop \n")); RC = xixcore_DeregisterHost(&pVCB->XixcoreVcb); if(pVCB->XixcoreVcb.MetaContext.HostDirtyLotMap) { xixcore_FreeBuffer(pVCB->XixcoreVcb.MetaContext.HostDirtyLotMap->Data); kfree(pVCB->XixcoreVcb.MetaContext.HostDirtyLotMap); pVCB->XixcoreVcb.MetaContext.HostDirtyLotMap = NULL; } if(pVCB->XixcoreVcb.MetaContext.HostFreeLotMap) { xixcore_FreeBuffer(pVCB->XixcoreVcb.MetaContext.HostFreeLotMap->Data); kfree(pVCB->XixcoreVcb.MetaContext.HostFreeLotMap); pVCB->XixcoreVcb.MetaContext.HostFreeLotMap = NULL; } if(pVCB->XixcoreVcb.MetaContext.VolumeFreeMap) { xixcore_FreeBuffer(pVCB->XixcoreVcb.MetaContext.VolumeFreeMap->Data); kfree(pVCB->XixcoreVcb.MetaContext.VolumeFreeMap); pVCB->XixcoreVcb.MetaContext.VolumeFreeMap = NULL; } } xixcore_DeleteALLChildCacheEntry(&pVCB->XixcoreVcb); if(pVCB->XixcoreVcb.VolumeName){ xixcore_FreeMem(pVCB->XixcoreVcb.VolumeName, XCTAG_VOLNAME); } spin_lock(&(xixfs_linux_global.sb_list_lock)); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK, ("spin_lock(&(xixfs_linux_global.sb_list_lock)) \n" )); list_del(&(pVCB->VCBLink)); spin_unlock(&(xixfs_linux_global.sb_list_lock)); DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK, ("spin_unlock(&(xixfs_linux_global.sb_list_lock)) \n" )); DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VFSAPIT|DEBUG_TARGET_VCB), ("Exit xixfs_put_super\n")); unload_nls(pVCB->nls_map); kfree(pVCB); #if LINUX_VERSION_25_ABOVE sb->s_fs_info = NULL; #else sb->u.generic_sbp = NULL; #endif }
VOID xixfs_CleanupFlushVCB( IN PXIXFS_IRPCONTEXT pIrpContext, IN PXIXFS_VCB pVCB, IN BOOLEAN DisMountVCB ) { //PAGED_CODE(); ASSERT_IRPCONTEXT( pIrpContext ); ASSERT_VCB( pVCB ); ASSERT_EXCLUSIVE_XIFS_GDATA; ASSERT_EXCLUSIVE_VCB(pVCB); DebugTrace(DEBUG_LEVEL_INFO, (DEBUG_TARGET_PNP| DEBUG_TARGET_VCB| DEBUG_TARGET_IRPCONTEXT), ("xixfs_CleanupFlushVCB Status(%ld).\n", pVCB->VCBState)); DebugTrace(DEBUG_LEVEL_INFO, (DEBUG_TARGET_PNP| DEBUG_TARGET_VCB| DEBUG_TARGET_IRPCONTEXT), ("11 Current VCB->PtrVPB->ReferenceCount %d \n", pVCB->PtrVPB->ReferenceCount)); XifsdLockVcb( pIrpContext, pVCB ); XIXCORE_SET_FLAGS(pVCB->VCBFlags, XIFSD_VCB_FLAGS_DEFERED_CLOSE); if(DisMountVCB){ if(pVCB->VolumeDasdFCB != NULL){ pVCB->VolumeDasdFCB->FCBReference -= 1; pVCB->VolumeDasdFCB->FCBUserReference -= 1; } if(pVCB->MetaFCB != NULL){ pVCB->MetaFCB->FCBReference -=1; pVCB->MetaFCB->FCBUserReference -= 1; } if(pVCB->RootDirFCB != NULL){ pVCB->RootDirFCB->FCBReference -=1; pVCB->RootDirFCB->FCBUserReference -= 1; } } XifsdUnlockVcb(pIrpContext, pVCB); xixfs_PurgeVolume(pIrpContext, pVCB, DisMountVCB); DebugTrace(DEBUG_LEVEL_INFO, (DEBUG_TARGET_PNP| DEBUG_TARGET_VCB| DEBUG_TARGET_IRPCONTEXT), ("22 Current VCB->PtrVPB->ReferenceCount %d \n", pVCB->PtrVPB->ReferenceCount)); if(DisMountVCB){ // Added by ILGU HONG XifsdReleaseVcb(TRUE, pVCB); DebugTrace(DEBUG_LEVEL_INFO, (DEBUG_TARGET_FSCTL|DEBUG_TARGET_VOLINFO ), ("VCB %d/%d \n", pVCB->VCBReference, pVCB->VCBUserReference)); CcWaitForCurrentLazyWriterActivity(); XifsdAcquireVcbExclusive(TRUE, pVCB, FALSE); xixfs_RealCloseFCB((PVOID)pVCB); } XifsdLockVcb( pIrpContext, pVCB ); XIXCORE_CLEAR_FLAGS(pVCB->VCBFlags, XIFSD_VCB_FLAGS_DEFERED_CLOSE); XifsdUnlockVcb(pIrpContext, pVCB); // Added by ILGU HONG END if(DisMountVCB){ // changed by ILGU HONG for readonly 09052006 if(!pVCB->XixcoreVcb.IsVolumeWriteProtected){ LARGE_INTEGER TimeOut; // // Stop Meta Update process // KeSetEvent(&pVCB->VCBUmountEvent, 0, FALSE); TimeOut.QuadPart = - DEFAULT_XIFS_UMOUNTWAIT; KeWaitForSingleObject(&pVCB->VCBStopOkEvent, Executive, KernelMode, FALSE, &TimeOut); xixcore_DeregisterHost(&pVCB->XixcoreVcb); // Added by ILGU HONG for 08312006 if(pVCB->NdasVolBacl_Id){ xixfs_RemoveUserBacl(pVCB->TargetDeviceObject, pVCB->NdasVolBacl_Id); } // Added by ILGU HONG End } // changed by ILGU HONG for readonly end } return; }