Commit 6ab855a
ocfs2: add ip_alloc_sem in direct IO to protect allocation changes
In ocfs2, ip_alloc_sem is used to protect allocation changes on the
node. In direct IO, we add ip_alloc_sem to protect date consistent
between direct-io and ocfs2_truncate_file race (buffer io use
ip_alloc_sem already). Although inode->i_mutex lock is used to avoid
concurrency of above situation, i think ip_alloc_sem is still needed
because protect allocation changes is significant.
Other filesystem like ext4 also uses rw_semaphore to protect data
consistent between get_block-vs-truncate race by other means, So
ip_alloc_sem in ocfs2 direct io is needed.
Signed-off-by: Weiwei Wang <[email protected]>
Signed-off-by: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent 3423768 commit 6ab855a
1 file changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
536 | 538 | | |
537 | 539 | | |
538 | 540 | | |
539 | 541 | | |
| 542 | + | |
| 543 | + | |
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
| |||
557 | 561 | | |
558 | 562 | | |
559 | 563 | | |
| 564 | + | |
| 565 | + | |
560 | 566 | | |
561 | 567 | | |
562 | 568 | | |
| |||
569 | 575 | | |
570 | 576 | | |
571 | 577 | | |
| 578 | + | |
572 | 579 | | |
573 | 580 | | |
574 | 581 | | |
575 | 582 | | |
576 | 583 | | |
577 | 584 | | |
578 | 585 | | |
| 586 | + | |
579 | 587 | | |
580 | 588 | | |
581 | 589 | | |
582 | 590 | | |
583 | 591 | | |
| 592 | + | |
584 | 593 | | |
585 | 594 | | |
586 | 595 | | |
| |||
835 | 844 | | |
836 | 845 | | |
837 | 846 | | |
838 | | - | |
| 847 | + | |
| 848 | + | |
839 | 849 | | |
840 | 850 | | |
841 | | - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
842 | 854 | | |
843 | 855 | | |
| 856 | + | |
| 857 | + | |
844 | 858 | | |
845 | 859 | | |
846 | 860 | | |
| |||
0 commit comments