File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 19
19
#include < util/system/hp_timer.h>
20
20
#include < util/system/mutex.h>
21
21
22
+ #include < cstdlib>
23
+
22
24
#include " device_test_tool.h"
23
25
24
26
#if defined(_tsan_enabled_)
@@ -219,8 +221,20 @@ class TAioTest : public TPerfTest {
219
221
DetectFileParameters (Cfg.Path , DeviceSizeBytes, isBlockDevice);
220
222
221
223
NPDisk::EIoResult res = IoContext->Setup (MaxEvents, Cfg.DoLockFile );
222
- Y_VERIFY_S (res == NPDisk::EIoResult::Ok, " Error initializing IoContext, error# " << res
223
- << " ; path# " << Cfg.Path .Quote ());
224
+ if (res != NPDisk::EIoResult::Ok) {
225
+ if (res == NPDisk::EIoResult::FileLockError) {
226
+ // find out the reason of the lock error
227
+ TString lsofCommand = " lsof " + Cfg.Path ;
228
+ int returnCode = system (lsofCommand.c_str ());
229
+ if (returnCode == 0 ) {
230
+ Y_FAIL_S (" File is locked by another process, see lsof output above" );
231
+ } else {
232
+ Y_FAIL_S (" Error in IoContext->Setup, error# " << res);
233
+ }
234
+ }
235
+ Y_VERIFY_S (res == NPDisk::EIoResult::Ok, " Error initializing IoContext, error# " << res
236
+ << " ; path# " << Cfg.Path .Quote ());
237
+ }
224
238
225
239
THolder<TFileHandle> file (new TFileHandle (Cfg.Path .c_str (), OpenExisting | RdWr | DirectAligned | Sync));
226
240
You can’t perform that action at this time.
0 commit comments