Commit dba9f99
smb: client: fix race with fallocate(2) and AIO+DIO
AIO+DIO may extend the file size, hence we need to make sure ->i_size
is stable across the entire fallocate(2) operation, otherwise it would
become a truncate and then inode size reduced back down when it
finishes.
Fix this by calling netfs_wait_for_outstanding_io() right after
acquiring ->i_rwsem exclusively in cifs_fallocate() and then guarantee
a stable ->i_size across fallocate(2).
Also call netfs_wait_for_outstanding_io() after truncating pagecache
to avoid any potential races with writeback.
Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
Reviewed-by: David Howells <[email protected]>
Fixes: 210627b ("smb: client: fix missing timestamp updates with O_TRUNC")
Cc: Frank Sorenson <[email protected]>
Cc: [email protected]
Signed-off-by: Steve French <[email protected]>1 parent b95cd1b commit dba9f99
3 files changed
+26
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
395 | 406 | | |
396 | | - | |
397 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
398 | 412 | | |
399 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
400 | 416 | | |
401 | 417 | | |
402 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3012 | 3012 | | |
3013 | 3013 | | |
3014 | 3014 | | |
| 3015 | + | |
3015 | 3016 | | |
3016 | 3017 | | |
3017 | 3018 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3367 | 3367 | | |
3368 | 3368 | | |
3369 | 3369 | | |
3370 | | - | |
3371 | 3370 | | |
3372 | 3371 | | |
3373 | 3372 | | |
| |||
3385 | 3384 | | |
3386 | 3385 | | |
3387 | 3386 | | |
| 3387 | + | |
3388 | 3388 | | |
3389 | 3389 | | |
3390 | 3390 | | |
| |||
3413 | 3413 | | |
3414 | 3414 | | |
3415 | 3415 | | |
3416 | | - | |
3417 | 3416 | | |
3418 | 3417 | | |
3419 | 3418 | | |
| |||
3437 | 3436 | | |
3438 | 3437 | | |
3439 | 3438 | | |
3440 | | - | |
3441 | 3439 | | |
3442 | 3440 | | |
3443 | 3441 | | |
| |||
3451 | 3449 | | |
3452 | 3450 | | |
3453 | 3451 | | |
| 3452 | + | |
3454 | 3453 | | |
3455 | 3454 | | |
3456 | 3455 | | |
| |||
3485 | 3484 | | |
3486 | 3485 | | |
3487 | 3486 | | |
3488 | | - | |
3489 | 3487 | | |
3490 | 3488 | | |
3491 | 3489 | | |
| |||
3749 | 3747 | | |
3750 | 3748 | | |
3751 | 3749 | | |
3752 | | - | |
3753 | | - | |
3754 | 3750 | | |
3755 | 3751 | | |
3756 | 3752 | | |
| |||
3765 | 3761 | | |
3766 | 3762 | | |
3767 | 3763 | | |
| 3764 | + | |
3768 | 3765 | | |
3769 | 3766 | | |
3770 | 3767 | | |
| |||
3785 | 3782 | | |
3786 | 3783 | | |
3787 | 3784 | | |
3788 | | - | |
3789 | | - | |
| 3785 | + | |
3790 | 3786 | | |
3791 | 3787 | | |
3792 | 3788 | | |
| |||
3803 | 3799 | | |
3804 | 3800 | | |
3805 | 3801 | | |
3806 | | - | |
3807 | | - | |
3808 | 3802 | | |
3809 | 3803 | | |
3810 | 3804 | | |
| |||
3819 | 3813 | | |
3820 | 3814 | | |
3821 | 3815 | | |
| 3816 | + | |
3822 | 3817 | | |
3823 | 3818 | | |
3824 | 3819 | | |
| |||
3841 | 3836 | | |
3842 | 3837 | | |
3843 | 3838 | | |
3844 | | - | |
3845 | | - | |
| 3839 | + | |
3846 | 3840 | | |
3847 | 3841 | | |
3848 | 3842 | | |
| |||
0 commit comments