From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 2/2] xfs: fix endian conversion issue in discard code
Date: Wed, 21 Dec 2011 11:07:42 +1100 [thread overview]
Message-ID: <1324426062-21505-3-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1324426062-21505-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
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.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_discard.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 8a24f0c..286a051 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/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.
--
1.7.5.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-12-21 0:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 0:07 [PATCH 0/2]: xfs - fixes found with sparse checking Dave Chinner
2011-12-21 0:07 ` [PATCH 1/2] xfs: clean up minor sparse warnings Dave Chinner
2011-12-21 16:13 ` Christoph Hellwig
2011-12-21 23:59 ` Dave Chinner
2011-12-22 18:15 ` Ben Myers
2012-02-01 18:33 ` Ben Myers
2011-12-21 0:07 ` Dave Chinner [this message]
2011-12-21 4:36 ` [PATCH 2/2] xfs: fix endian conversion issue in discard code Ben Myers
2012-01-06 15:12 ` Christoph Hellwig
2012-01-06 15:38 ` Ben Myers
2011-12-21 16:11 ` Christoph Hellwig
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=1324426062-21505-3-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=xfs@oss.sgi.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