diff --git a/src/gausskernel/storage/buffer/bufmgr.cpp b/src/gausskernel/storage/buffer/bufmgr.cpp index 5e96bec661be7edf43bcda798c43995bc0f88cb5..3f959e22eee662040d92e5e5abb6e669c5899687 100644 --- a/src/gausskernel/storage/buffer/bufmgr.cpp +++ b/src/gausskernel/storage/buffer/bufmgr.cpp @@ -4141,8 +4141,14 @@ bool SyncFlushOneBuffer(int buf_id, bool get_condition_lock) * buffer is clean by the time we've locked it.) */ PinBuffer_Locked(buf_desc); - - if ((dw_enabled() || ENABLE_DSS) && get_condition_lock) { + + /* + * To past the fastcheck_single_mot, we have to save LWLockAcquire. + */ + #ifdef ENABLE_MOT + if ((dw_enabled() || ENABLE_DSS) && get_condition_lock) + #endif + { /* * We must use a conditional lock acquisition here to avoid deadlock. If * page_writer and double_write are enabled, only page_writer is allowed to @@ -4177,9 +4183,12 @@ bool SyncFlushOneBuffer(int buf_id, bool get_condition_lock) } break; } - } else { + } + #ifdef ENABLE_MOT + else { (void)LWLockAcquire(buf_desc->content_lock, LW_SHARED); } + #endif if (ENABLE_DMS && buf_desc->extra->aio_in_progress) { LWLockRelease(buf_desc->content_lock);