diff --git a/cloud/filestore/libs/vfs_fuse/fs_impl.cpp b/cloud/filestore/libs/vfs_fuse/fs_impl.cpp index 1a98d728fd..dffd391f7e 100644 --- a/cloud/filestore/libs/vfs_fuse/fs_impl.cpp +++ b/cloud/filestore/libs/vfs_fuse/fs_impl.cpp @@ -279,10 +279,12 @@ void TFileSystem::ProcessHandleOpsQueue() RequestStats->RequestStarted(Log, *callContext); Session->DestroyHandle(callContext, std::move(request)) - .Subscribe([this, ptr = weak_from_this()] (const auto& future) { + .Subscribe([=, ptr = weak_from_this()] (const auto& future) { const auto& response = future.GetValue(); const auto& error = response.GetError(); if (auto self = ptr.lock()) { + RequestStats->RequestCompleted(*callContext, error); + // If destroy request failed, we need to retry it. // Otherwise, remove it from queue. if (HasError(error)) { diff --git a/cloud/filestore/libs/vfs_fuse/fs_ut.cpp b/cloud/filestore/libs/vfs_fuse/fs_ut.cpp index b8126b1696..e107605390 100644 --- a/cloud/filestore/libs/vfs_fuse/fs_ut.cpp +++ b/cloud/filestore/libs/vfs_fuse/fs_ut.cpp @@ -1439,9 +1439,15 @@ Y_UNIT_TEST_SUITE(TFileSystemTest) std::atomic_bool releaseFinished = false; std::atomic_uint handlerCalled = 0; auto destroyFinished = NewPromise(); + auto counters = bootstrap.Counters->FindSubgroup("component", "fs_ut") + ->FindSubgroup("request", "DestroyHandle"); bootstrap.Service->SetHandlerDestroyHandle( [&, destroyFinished](auto callContext, auto request) mutable { + UNIT_ASSERT_VALUES_EQUAL( + 1, + counters->GetCounter("InProgress")->GetAtomic()); + UNIT_ASSERT_VALUES_EQUAL( FileSystemId, callContext->FileSystemId); @@ -1475,6 +1481,7 @@ Y_UNIT_TEST_SUITE(TFileSystemTest) destroyFinished.GetFuture().Wait(WaitTimeout); UNIT_ASSERT_VALUES_EQUAL(2U, handlerCalled.load()); + UNIT_ASSERT_VALUES_EQUAL(0, counters->GetCounter("InProgress")->GetAtomic()); } Y_UNIT_TEST(ShouldRetryDestroyIfNotSuccessDuringAsyncProcessing)