summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorMiao Xie2012-09-06 12:04:27 +0200
committerChris Mason2012-10-01 21:19:12 +0200
commit2ecb79239bcd04c9d410f4cdce16adb6840b19da (patch)
tree9a2194dde73a1a822fa011c35745c3aafa316f86 /fs/btrfs/file.c
parentBtrfs: fix wrong size for the reservation of the, snapshot creation (diff)
downloadkernel-qcow2-linux-2ecb79239bcd04c9d410f4cdce16adb6840b19da.tar.gz
kernel-qcow2-linux-2ecb79239bcd04c9d410f4cdce16adb6840b19da.tar.xz
kernel-qcow2-linux-2ecb79239bcd04c9d410f4cdce16adb6840b19da.zip
Btrfs: fix unprotected ->log_batch
We forget to protect ->log_batch when syncing a file, this patch fix this problem by atomic operation. And ->log_batch is used to check if there are parallel sync operations or not, so it is unnecessary to reset it to 0 after the sync operation of the current log tree complete. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a9d7815cf58e..793bc89c660f 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1551,9 +1551,9 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* ordered range does a filemape_write_and_wait_range which is why we
* don't do it above like other file systems.
*/
- root->log_batch++;
+ atomic_inc(&root->log_batch);
btrfs_wait_ordered_range(inode, start, end);
- root->log_batch++;
+ atomic_inc(&root->log_batch);
/*
* check the transaction that last modified this inode