Commit 5326a68
Fix test_passthroughfs() failure due to unexpected mtime/ctime differences (#130)
What's happening here is the following:
- If the FUSE (kernel-level) writeback cache is enabled, the filesystem
daemon cannot be trusted by the kernel to produce accurate mtime and
ctime values, because there may be pending writes in the cache that
have not been flushed to the daemon.
- Therefore, the kernel still calls the getattr() handler, but ignores
the mtime and ctime values, and instead maintains them internally.
- When a file is closed, the kernel communicates the correct mtime and
ctime values to the filesystem daemon through an extra setattr() call.
- Therefore, the (correct) mtime value that a userspace program gets
from the kernel for the FUSE filesystem will not agree with the (also
correct) mtime value reported by the underlying filesystem as long as
the file is open.
- Once the file has been closed, the mtime values agree, but the
filesystem daemon has updated this with an utimens() call which has
resulted in ctime change, so now the ctime values do not agree.
To fix this, make the writeback cache configurable and only check mtimes
if writeback caching is disabled.
Fixes: #57.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent d34dfbd commit 5326a68
2 files changed
Lines changed: 26 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
78 | 76 | | |
| 77 | + | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
| |||
534 | 533 | | |
535 | 534 | | |
536 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
537 | 542 | | |
538 | 543 | | |
539 | 544 | | |
540 | 545 | | |
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
544 | | - | |
| 549 | + | |
545 | 550 | | |
546 | 551 | | |
547 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
128 | | - | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | | - | |
| 414 | + | |
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
| |||
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | | - | |
| 425 | + | |
423 | 426 | | |
424 | 427 | | |
425 | 428 | | |
| |||
431 | 434 | | |
432 | 435 | | |
433 | 436 | | |
434 | | - | |
| 437 | + | |
435 | 438 | | |
436 | 439 | | |
437 | 440 | | |
| |||
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
449 | | - | |
| 452 | + | |
450 | 453 | | |
451 | 454 | | |
452 | | - | |
| 455 | + | |
453 | 456 | | |
454 | 457 | | |
455 | 458 | | |
| |||
471 | 474 | | |
472 | 475 | | |
473 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
474 | 484 | | |
0 commit comments