public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alain Renaud <arenaud@sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs: prevent xfs_bmap_extsize_align() to exceed maximum extent size.
Date: Fri, 13 Jul 2012 12:09:28 +0200	[thread overview]
Message-ID: <4FFFF3D8.7060001@sgi.com> (raw)
In-Reply-To: <20120712154554.377970666@sgi.com>

xfs: prevent xfs_bmap_extsize_align() to exceed maximum extent size.

When trying to do preallocation that exceed the the maximum size of
an extent, the extsize alignment can exceed this value.
We are already trying to solve this issue for delay allocation but we
have the same with prealloc. So I think the simple solution is to limit
the size in xfs_bmap_extsize_align() and remove the code specific to
delay allocation.

We do have a simple test case to confirm that the problem exist.

# cd /xfs_dir/
# xfs_io -c 'extsize 4m' .
# xfs_io -f -c 'resvsp 0 8g' test_file
XFS_IOC_RESVSP64: No space left on device

Signed-off-by: Alain Renaud <arenaud@sgi.com>

---
  fs/xfs/xfs_bmap.c |   12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)

Index: b/fs/xfs/xfs_bmap.c
===================================================================
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -1912,6 +1912,11 @@ xfs_bmap_extsize_align(
  		align_alen += extsz - temp;
  	}
  	/*
+	 * Make sure we do not exceed the maximum len of an extent.
+	 */
+	align_alen = XFS_FILBLKS_MIN(align_alen,
+				     MAXEXTLEN - (MAXEXTLEN % extsz));
+	/*
  	 * If the previous block overlaps with this proposed allocation
  	 * then move the start forward without adjusting the length.
  	 */
@@ -4450,13 +4455,6 @@ xfs_bmapi_reserve_delalloc(
  	/* Figure out the extent size, adjust alen */
  	extsz = xfs_get_extsz_hint(ip);
  	if (extsz) {
-		/*
-		 * Make sure we don't exceed a single extent length when we
-		 * align the extent by reducing length we are going to
-		 * allocate by the maximum amount extent size aligment may
-		 * require.
-		 */
-		alen = XFS_FILBLKS_MIN(len, MAXEXTLEN - (2 * extsz - 1));
  		error = xfs_bmap_extsize_align(mp, got, prev, extsz, rt, eof,
  					       1, 0, &aoff, &alen);
  		ASSERT(!error);

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

       reply	other threads:[~2012-07-13 10:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120712154554.377970666@sgi.com>
2012-07-13 10:09 ` Alain Renaud [this message]
2012-07-17 16:35   ` [PATCH V2] xfs: prevent xfs_bmap_extsize_align() to exceed maximum extent size Alain Renaud
2012-07-19  3:30     ` Dave Chinner
2012-07-19  8:20       ` Alain Renaud
2012-07-20  1:44         ` Dave Chinner
2012-07-20  8:05           ` Alain Renaud
2012-08-23 16:52             ` [PATCH V3] xfs: prevent xfs_bmapi_write() " Alain Renaud

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=4FFFF3D8.7060001@sgi.com \
    --to=arenaud@sgi.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