All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Sage Weil <sage@newdream.net>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: fix pages truncation in btrfs_ioctl_clone()
Date: Mon, 19 Sep 2011 11:07:14 +0800	[thread overview]
Message-ID: <4E76B1E2.3070402@cn.fujitsu.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1109160934590.11043@cobra.newdream.net>

>> Also move the function before locking extent state.
> 
> Hmm, any reason?  i_mutex protects us from a racing write(2), but what 
> about a racing mmap()?  e.g.
> 
> cloner: truncates dest pages
> writer: mmap -> page_mkwrite locks extent, creates new dirty page, unlocks
> cloner: locks extent, clones, unlocks extent
> 

(besides Chris' comments)

How can we avoid the race on dst file by locking src file extent state..

--
Li Zefan

      parent reply	other threads:[~2011-09-19  3:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16  8:59 [PATCH] Btrfs: fix pages truncation in btrfs_ioctl_clone() Li Zefan
2011-09-16 16:39 ` Sage Weil
2011-09-18 15:31   ` Chris Mason
2011-09-19  5:40     ` Sage Weil
2011-09-19  3:07   ` Li Zefan [this message]

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=4E76B1E2.3070402@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sage@newdream.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.