Commit 0d94230
fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE
commit cbfecb9 upstream.
Currently the I_DIRTY_TIME will never get set if the inode already has
I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's
true, however ext4 will only update the on-disk inode in
->dirty_inode(), not on actual writeback. As a result if the inode
already has I_DIRTY_INODE state by the time we get to
__mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled
into on-disk inode and will not get updated until the next I_DIRTY_INODE
update, which might never come if we crash or get a power failure.
The problem can be reproduced on ext4 by running xfstest generic/622
with -o iversion mount option.
Fix it by allowing I_DIRTY_TIME to be set even if the inode already has
I_DIRTY_INODE. Also make sure that the case is properly handled in
writeback_single_inode() as well. Additionally changes in
xfs_fs_dirty_inode() was made to accommodate for I_DIRTY_TIME in flag.
Thanks Jan Kara for suggestions on how to make this work properly.
Cc: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220825100657.44217-1-lczerner@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 95a520b commit 0d94230
File tree
4 files changed
+41
-18
lines changed- Documentation/filesystems
- fs
- xfs
- include/linux
4 files changed
+41
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1745 | 1745 | | |
1746 | 1746 | | |
1747 | 1747 | | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1751 | 1756 | | |
1752 | 1757 | | |
1753 | 1758 | | |
| |||
2400 | 2405 | | |
2401 | 2406 | | |
2402 | 2407 | | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
2403 | 2422 | | |
2404 | 2423 | | |
2405 | 2424 | | |
| |||
2409 | 2428 | | |
2410 | 2429 | | |
2411 | 2430 | | |
2412 | | - | |
| 2431 | + | |
| 2432 | + | |
2413 | 2433 | | |
2414 | 2434 | | |
2415 | 2435 | | |
| |||
2430 | 2450 | | |
2431 | 2451 | | |
2432 | 2452 | | |
2433 | | - | |
2434 | | - | |
| 2453 | + | |
2435 | 2454 | | |
2436 | 2455 | | |
2437 | 2456 | | |
2438 | | - | |
2439 | | - | |
2440 | 2457 | | |
2441 | 2458 | | |
2442 | 2459 | | |
2443 | 2460 | | |
2444 | 2461 | | |
2445 | | - | |
2446 | | - | |
2447 | | - | |
2448 | 2462 | | |
2449 | 2463 | | |
2450 | 2464 | | |
| |||
2517 | 2531 | | |
2518 | 2532 | | |
2519 | 2533 | | |
2520 | | - | |
2521 | 2534 | | |
2522 | 2535 | | |
2523 | 2536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
| 645 | + | |
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
654 | 660 | | |
655 | 661 | | |
656 | 662 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2288 | 2288 | | |
2289 | 2289 | | |
2290 | 2290 | | |
2291 | | - | |
| 2291 | + | |
2292 | 2292 | | |
2293 | 2293 | | |
2294 | 2294 | | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
2298 | 2299 | | |
2299 | 2300 | | |
2300 | 2301 | | |
| |||
0 commit comments