diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-02-08 07:01:08 +0000 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 12:59:47 -0500 |
commit | 2e60a51e62185cce48758e596ae7cb2da673b58f (patch) | |
tree | bdbbac16110a3eeda8732c3ffb38a440204e2831 /usr | |
parent | 0934856d4697e63c14056375e26e3bd6e8ebd34b (diff) | |
download | blackbird-op-linux-2e60a51e62185cce48758e596ae7cb2da673b58f.tar.gz blackbird-op-linux-2e60a51e62185cce48758e596ae7cb2da673b58f.zip |
Btrfs: serialize unlocked dio reads with truncate
Currently, we can do unlocked dio reads, but the following race
is possible:
dio_read_task truncate_task
->btrfs_setattr()
->btrfs_direct_IO
->__blockdev_direct_IO
->btrfs_get_block
->btrfs_truncate()
#alloc truncated blocks
#to other inode
->submit_io()
#INFORMATION LEAK
In order to avoid this problem, we must serialize unlocked dio reads with
truncate. There are two approaches:
- use extent lock to protect the extent that we truncate
- use inode_dio_wait() to make sure the truncating task will wait for
the read DIO.
If we use the 1st one, we will meet the endless truncation problem due to
the nonlocked read DIO after we implement the nonlocked write DIO. It is
because we still need invoke inode_dio_wait() avoid the race between write
DIO and truncation. By that time, we have to introduce
btrfs_inode_{block, resume}_nolock_dio()
again. That is we have to implement this patch again, so I choose the 2nd
way to fix the problem.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions