]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix preallocate vs double nocow write
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 27 Feb 2014 05:58:05 +0000 (13:58 +0800)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:17:00 +0000 (15:17 -0400)
commitf898812c593fda72d66d56674d2e88f01aa9c989
treeb1f0715cb4140c4ddd63bf3c6e70f1900c8b9acf
parent08f629af1b18723480845751a7f6c2813336ce78
Btrfs: fix preallocate vs double nocow write

We can not release the reserved metadata space for the first write if we
find the write position is pre-allocated. Because the kernel might write
the data on the disk before we do the second write but after the can-nocow
check, if we release the space for the first write, we might fail to update
the metadata because of no space.

Fix this problem by end nocow write if there is dirty data in the range whose
space is pre-allocated.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/file.c
fs/btrfs/inode.c