public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: 8411@debbugs.gnu.org
Cc: linux-ext4@vger.kernel.org
Subject: Re: bug#8411: due to missing sync even on 2.6.39,	cp fails to copy an odd file
Date: Sat, 02 Apr 2011 14:29:16 +0100	[thread overview]
Message-ID: <4D9724AC.2070009@draigBrady.com> (raw)
In-Reply-To: <87fwq0gay0.fsf@rho.meyering.net>

On 02/04/11 12:16, Jim Meyering wrote:
> Hi Pádraig,
> 
> As of this change,
> 
>     copy: with fiemap copy, only sync when needed
>     http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=f69876e55
> 
> fiemap copy with extents beyond EOF can fail on ext4 even with
> Fedora 15 (2.6.38) and rawhide's 2.6.39 kernel.
> 
> Here we construct an odd file.  First, preallocate 10MB of space,
> and then write 5KiB of random data into the beginning of that:
> 
>     $ fallocate -l 10000000 -n k
>     $ dd count=10 if=/dev/urandom conv=notrunc iflag=fullblock of=k
> 
> However, when we try to copy "k", we get a file, "k2" of the
> expected size, but with only NUL bytes for contents:

So the extent info is not updated until sync(),
which means cp will consider the "unwritten" extent
as NUL data and not bother to read it :(

I guess this is a corner case that was missed
in the fixups for ext4 (and btrfs?) in 2.6.38 for this?
I've copied ext4 devs for clarification.
I.E. if you do this:

  fallocate -l 10000000 -n k
  dd count=10 if=/dev/urandom conv=notrunc iflag=fullblock of=k
  filefrag -v k

Do you get all extents still unwritten.
I do on my 2.6.35.11-83.fc14.i686 kernel, but I expected that.

cheers,
Pádraig.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2011-04-02 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fwq0gay0.fsf@rho.meyering.net>
2011-04-02 13:29 ` Pádraig Brady [this message]
2011-04-02 13:50   ` bug#8411: due to missing sync even on 2.6.39, cp fails to copy an odd file Jim Meyering
2011-04-02 18:08     ` Jim Meyering
2011-04-02 23:00       ` Ted Ts'o
2011-04-03 10:12         ` Pádraig Brady
2011-04-03 10:26           ` Jim Meyering
2011-04-03 10:46           ` Theodore Tso
2011-04-03 10:15         ` Jim Meyering

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=4D9724AC.2070009@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=8411@debbugs.gnu.org \
    --cc=linux-ext4@vger.kernel.org \
    /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