File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1380,6 +1380,7 @@ os_file_create_simple_no_error_handling_func(
1380
1380
*success = (file != INVALID_HANDLE_VALUE);
1381
1381
#else /* __WIN__ */
1382
1382
int create_flag;
1383
+ const char * mode_str = NULL ;
1383
1384
1384
1385
ut_a (name);
1385
1386
@@ -1388,6 +1389,8 @@ os_file_create_simple_no_error_handling_func(
1388
1389
1389
1390
if (create_mode == OS_FILE_OPEN) {
1390
1391
1392
+ mode_str = " OPEN" ;
1393
+
1391
1394
if (access_type == OS_FILE_READ_ONLY) {
1392
1395
1393
1396
create_flag = O_RDONLY;
@@ -1406,10 +1409,14 @@ os_file_create_simple_no_error_handling_func(
1406
1409
1407
1410
} else if (srv_read_only_mode) {
1408
1411
1412
+ mode_str = " OPEN" ;
1413
+
1409
1414
create_flag = O_RDONLY;
1410
1415
1411
1416
} else if (create_mode == OS_FILE_CREATE) {
1412
1417
1418
+ mode_str = " CREATE" ;
1419
+
1413
1420
create_flag = O_RDWR | O_CREAT | O_EXCL;
1414
1421
1415
1422
} else {
@@ -1424,6 +1431,17 @@ os_file_create_simple_no_error_handling_func(
1424
1431
1425
1432
*success = file == -1 ? FALSE : TRUE ;
1426
1433
1434
+ /* This function is always called for data files, we should disable
1435
+ OS caching (O_DIRECT) here as we do in os_file_create_func(), so
1436
+ we open the same file in the same mode, see man page of open(2). */
1437
+ if (!srv_read_only_mode
1438
+ && *success
1439
+ && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
1440
+ || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
1441
+
1442
+ os_file_set_nocache (file, name, mode_str);
1443
+ }
1444
+
1427
1445
#ifdef USE_FILE_LOCK
1428
1446
if (!srv_read_only_mode
1429
1447
&& *success
You can’t perform that action at this time.
0 commit comments