[Bug 32972] EXT4 causes corrupt BitTorrent downloads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=32972





--- Comment #1 from Anonymous Emailer <anonymous@xxxxxxxxxxxxxxxxxxxx>  2011-04-10 14:30:37 ---
Reply-To: xiaoqiangnk@xxxxxxxxx

Ah, it is a wrong fix.

original code:
    map_bh(bh, inode->i_sb, map.m_pblk);
    bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS) | map.m_flags;

    if (buffer_unwritten(bh)) {
        /* A delayed write to unwritten bh should be marked
         * new and mapped.  Mapped ensures that we don't do
         * get_block multiple times when we write to the same
         * offset and new ensures that we do proper zero out
         * for partial write.
         */
        set_buffer_new(bh);
        set_buffer_mapped(bh);
    }

after the patch:
    map_bh(bh, inode->i_sb, map.m_pblk);
    bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS) | map.m_flags;

    if (buffer_unwritten(bh)) {
        /* A delayed write to unwritten bh should be marked
         * new and mapped.  Mapped ensures that we don't do
         * get_block multiple times when we write to the same
         * offset and new ensures that we do proper zero out
         * for partial write.
         */
        set_buffer_new(bh);
    }

Actually, mapped flag is cleared by statement:
    bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS) | map.m_flags;

So the right code should beï

    bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS) | map.m_flags;
    map_bh(bh, inode->i_sb, map.m_pblk);
    if (buffer_unwritten(bh)) {
        /* A delayed write to unwritten bh should be marked
         * new and mapped.  Mapped ensures that we don't do
         * get_block multiple times when we write to the same
         * offset and new ensures that we do proper zero out
         * for partial write.
         */
        set_buffer_new(bh);
    }



On Sun, Apr 10, 2011 at 9:44 PM,  <bugzilla-daemon@xxxxxxxxxxxxxxxxxxx> wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=32972
>
> Â Â Â Â Â Summary: EXT4 causes corrupt BitTorrent downloads
> Â Â Â Â Â Product: File System
> Â Â Â Â Â Version: 2.5
> Â ÂKernel Version: 2.6.39-rc2+
> Â Â Â Â ÂPlatform: All
> Â Â Â ÂOS/Version: Linux
> Â Â Â Â Â Â ÂTree: Mainline
> Â Â Â Â Â ÂStatus: NEW
> Â Â Â Â ÂSeverity: high
> Â Â Â Â ÂPriority: P1
> Â Â Â Â Component: ext4
> Â Â Â ÂAssignedTo: fs_ext4@xxxxxxxxxxxxxxxxxxxx
> Â Â Â ÂReportedBy: damien@xxxxxxxxxxxx
> Â Â Â Â Â Â Â ÂCC: feng.tang@xxxxxxxxx
> Â Â Â ÂRegression: Yes
>
>
> Using the Transmission BitTorrent client (version 2.11) with the most recent
> kernel (2.6.39-rc2+), any torrent I try to download is corrupt. By using
> Transmission's "Verify Local Data" functionality, I am able to reproduce this
> consistently. During verification, the percent complete will reverse itself as
> the verification process invalidates pieces that were just downloaded.
>
> I was able to bisect the issue and track it down to this commit:
>
> commit 6de9843dab3f2a1d4d66d80aa9e5782f80977d20
> Author: Feng Tang <feng.tang@xxxxxxxxx>
> Date: Â Wed Mar 23 14:05:03 2011 -0400
>
> Â Âext4: remove redundant set_buffer_mapped() in ext4_da_get_block_prep()
>
> Â ÂThe map_bh() call will have already set the buffer_head to mapped.
>
> Â ÂSigned-off-by: Feng Tang <feng.tang@xxxxxxxxx>
> Â ÂSigned-off-by: "Theodore Ts'o" <tytso@xxxxxxx>
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index f44307a..dec10e2 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2502,7 +2502,6 @@ static int ext4_da_get_block_prep(struct inode *inode,
> sector_t iblock,
> Â Â Â Â Â Â Â Â * for partial write.
> Â Â Â Â Â Â Â Â */
> Â Â Â Â Â Â Â Âset_buffer_new(bh);
> - Â Â Â Â Â Â Â set_buffer_mapped(bh);
> Â Â Â Â}
> Â Â Â Âreturn 0;
> Â}
>
>
> I confirmed that reverting this commit makes the problem go away.
>
> Thanks,
> -Damien
>
> --
> Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are watching the assignee of the bug.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux