public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <aelder@sgi.com>
To: xfs@oss.sgi.com
Subject: [Fwd: [PATCH] xfstests: limit OP_PUNCH_HOLE operations to the file size]
Date: Fri, 7 Oct 2011 17:41:38 -0500	[thread overview]
Message-ID: <1318027298.2810.82.camel@doink> (raw)

Review?

-------- Forwarded Message --------
From: Alex Elder <aelder@americas.sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfstests: limit OP_PUNCH_HOLE operations to the file
size
Date: Wed, 21 Sep 2011 15:18:06 -0500

Before punching a hole in a file, TRIM_OFF_LEN() calls
TRIM_OFF_LEN() in order to make sure the offset and size
used are in a reasonable range.  But currently the range
it's limited to is maxfilelen, which allows the offset
(and therefore offset + len) to be beyond EOF.

Later, do_punch_hole() ignores any request that starts beyond
EOF, so we might as well limit requests to the file size.

It appears that a hole punch request that starts within a
file but whose length extends beyond it is treated simply
as a hole punch up to EOF.  So there's no harm in limiting
the end of a hole punch request to the file size either.

Therefore, use TRIM_OFF_LEN() to put both the the offset
and length of a request within the file size for hole
punch requests.

Signed-off-by: Alex Elder <aelder@sgi.com>

---
 ltp/fsx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/ltp/fsx.c
===================================================================
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1085,7 +1085,7 @@ test(void)
 		break;
 
 	case OP_PUNCH_HOLE:
-		TRIM_OFF_LEN(offset, size, maxfilelen);
+		TRIM_OFF_LEN(offset, size, file_size);
 		do_punch_hole(offset, size);
 		break;
 	default:


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

                 reply	other threads:[~2011-10-07 22:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1318027298.2810.82.camel@doink \
    --to=aelder@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