Skip to content

Commit c8f0ee3

Browse files
authored
Introduce overlapping zero or write requests IBlockStore protection layer (#5282)
1 parent a5b8f1b commit c8f0ee3

File tree

14 files changed

+1509
-2
lines changed

14 files changed

+1509
-2
lines changed

cloud/blockstore/config/server.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ message TServerConfig
268268
// Optimal IO size for vhost devices. Zero value is the default one.
269269
// For linux, sets the value of /sys/block/<device>/queue/optimal_io_size.
270270
optional uint32 VhostOptimalIoSize = 127;
271+
272+
// Enables protection from executing overlapping zero or write requests.
273+
optional bool EnableOverlappingRequestsGuard = 128;
271274
}
272275

273276
////////////////////////////////////////////////////////////////////////////////

cloud/blockstore/libs/client/switchable_session.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace NCloud::NBlockStore::NClient {
2121
// 7. The old session is drained.
2222
// 8. The old session and all its underlying clients are deleted.
2323
/*
24+
Diagram
2425
Vhost
2526
|
2627
v
@@ -56,6 +57,9 @@ namespace NCloud::NBlockStore::NClient {
5657
| |
5758
v v
5859
StorageDataClient StorageDataClient
60+
| |
61+
v v
62+
IStorage IStorage
5963
*/
6064

6165
struct ISwitchableSession: public ISession

cloud/blockstore/libs/daemon/common/bootstrap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <cloud/blockstore/libs/server/config.h>
5555
#include <cloud/blockstore/libs/server/server.h>
5656
#include <cloud/blockstore/libs/service/device_handler.h>
57+
#include <cloud/blockstore/libs/service/overlapping_requests_guard_service.h>
5758
#include <cloud/blockstore/libs/service/request_helpers.h>
5859
#include <cloud/blockstore/libs/service/service.h>
5960
#include <cloud/blockstore/libs/service/service_error_transform.h>
@@ -242,6 +243,10 @@ void TBootstrapBase::Init()
242243

243244
STORAGE_INFO("Service initialized");
244245

246+
if (Configs->ServerConfig->GetEnableOverlappingRequestsGuard()) {
247+
Service = CreateOverlappingRequestsGuardsService(std::move(Service));
248+
}
249+
245250
if (Configs->RdmaConfig->GetBlockstoreServerTargetEnabled()) {
246251
InitRdmaRequestServer();
247252
if (RdmaRequestServer) {

cloud/blockstore/libs/server/config.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ constexpr TDuration Seconds(int s)
2323
}
2424

2525
////////////////////////////////////////////////////////////////////////////////
26-
26+
// clang-format off
2727
#define BLOCKSTORE_SERVER_CONFIG(xxx) \
2828
xxx(Host, TString, "localhost" )\
2929
xxx(Port, ui32, 9766 )\
@@ -112,9 +112,12 @@ constexpr TDuration Seconds(int s)
112112
NProto::EEncryptZeroPolicy, \
113113
NProto::EZP_WRITE_ENCRYPTED_ZEROS )\
114114
xxx(VhostPteFlushByteThreshold, ui64, 0 )\
115-
xxx(AutomaticNbdDeviceManagement,bool, false )
115+
xxx(AutomaticNbdDeviceManagement,bool, false )\
116+
xxx(EnableOverlappingRequestsGuard, bool, false )\
116117
// BLOCKSTORE_SERVER_CONFIG
117118

119+
// clang-format on
120+
118121
#define BLOCKSTORE_SERVER_DECLARE_CONFIG(name, type, value) \
119122
Y_DECLARE_UNUSED static const type Default##name = value; \
120123
// BLOCKSTORE_SERVER_DECLARE_CONFIG

cloud/blockstore/libs/server/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class TServerAppConfig
143143
NProto::EEncryptZeroPolicy GetEncryptZeroPolicy() const;
144144
ui64 GetVhostPteFlushByteThreshold() const;
145145
bool GetAutomaticNbdDeviceManagement() const;
146+
bool GetEnableOverlappingRequestsGuard() const;
146147

147148
void Dump(IOutputStream& out) const override;
148149
void DumpHtml(IOutputStream& out) const override;

0 commit comments

Comments
 (0)