summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9dbea72a61fe..89f5be2bfb43 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2068,6 +2068,18 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
2068 u64 len; 2068 u64 len;
2069 2069
2070 /* 2070 /*
2071 * If the inode needs a full sync, make sure we use a full range to
2072 * avoid log tree corruption, due to hole detection racing with ordered
2073 * extent completion for adjacent ranges, and assertion failures during
2074 * hole detection.
2075 */
2076 if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
2077 &BTRFS_I(inode)->runtime_flags)) {
2078 start = 0;
2079 end = LLONG_MAX;
2080 }
2081
2082 /*
2071 * The range length can be represented by u64, we have to do the typecasts 2083 * The range length can be represented by u64, we have to do the typecasts
2072 * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() 2084 * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
2073 */ 2085 */