xfs
[Top] [All Lists]

[16/65] xfs: fix endian conversion issue in discard code

To: linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, bpm@xxxxxxx
Subject: [16/65] xfs: fix endian conversion issue in discard code
From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 01 Feb 2012 12:55:56 -0800
Cc: torvalds@xxxxxxxxxxxxxxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, alan@xxxxxxxxxxxxxxxxxxx, Dave Chinner <dchinner@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:to:cc:subject :in-reply-to; s=smtpout; bh=4wFk5XtZfCwZlFvoVPK3gN4ET9M=; b=CZUS ZNYdcG4SAIx3LQCLJUFc89JH//Eo+gUqs9e2JW3jLheqOzZ4su56P2D+vXgMdJRO Z3A4p+sW6UvAvI7I1RxvqkyZB7QoQuSnsmvCHfTU3miXABqRQ89yFGeKwu9ztwb6 QMDa++7rYvLPbMaerhILT2+9U3YP4Wxd4AY1c4A=
In-reply-to: <20120201210236.GA25966@xxxxxxxxx>
User-agent: quilt/0.51-15.1
3.0-stable review patch.  If anyone has any objections, please let me know.

------------------


From: Dave Chinner <dchinner@xxxxxxxxxx>

commit b1c770c273a4787069306fc82aab245e9ac72e9d upstream

When finding the longest extent in an AG, we read the value directly
out of the AGF buffer without endian conversion. This will give an
incorrect length, resulting in FITRIM operations potentially not
trimming everything that it should.

Note, for 3.0-stable this has been modified to apply to
fs/xfs/linux-2.6/xfs_discard.c instead of fs/xfs/xfs_discard.c.  -bpm

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Ben Myers <bpm@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 fs/xfs/linux-2.6/xfs_discard.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/xfs/linux-2.6/xfs_discard.c
+++ b/fs/xfs/linux-2.6/xfs_discard.c
@@ -68,7 +68,7 @@ xfs_trim_extents(
         * Look up the longest btree in the AGF and start with it.
         */
        error = xfs_alloc_lookup_le(cur, 0,
-                                   XFS_BUF_TO_AGF(agbp)->agf_longest, &i);
+                           be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest), &i);
        if (error)
                goto out_del_cursor;
 
@@ -84,7 +84,7 @@ xfs_trim_extents(
                if (error)
                        goto out_del_cursor;
                XFS_WANT_CORRUPTED_GOTO(i == 1, out_del_cursor);
-               ASSERT(flen <= XFS_BUF_TO_AGF(agbp)->agf_longest);
+               ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest));
 
                /*
                 * Too small?  Give up.


<Prev in Thread] Current Thread [Next in Thread>
  • [16/65] xfs: fix endian conversion issue in discard code, Greg KH <=