From: Josef Bacik <jbacik@fusionio.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] Btrfs: serialize unlocked dio reads with truncate
Date: Thu, 31 Jan 2013 11:40:41 -0500 [thread overview]
Message-ID: <20130131164041.GP3660@localhost.localdomain> (raw)
In-Reply-To: <510A3807.1040306@cn.fujitsu.com>
On Thu, Jan 31, 2013 at 02:23:19AM -0700, Miao Xie wrote:
> 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 by inode_dio_wait().
>
So I had thinking about this, are we sure we don't want to just lock the extent
range when we truncate? I'm good with this, but it seems like we might as well
and be consistent and use the extent locks. What do you think? Thanks,
Josef
next prev parent reply other threads:[~2013-01-31 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 9:23 [PATCH 1/2] Btrfs: serialize unlocked dio reads with truncate Miao Xie
2013-01-31 16:40 ` Josef Bacik [this message]
2013-02-01 5:56 ` Miao Xie
2013-02-01 14:40 ` Josef Bacik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130131164041.GP3660@localhost.localdomain \
--to=jbacik@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).