public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: xfs@oss.sgi.com
Subject: [PATCH, RFC] fix XFSQA 145 / test_hole
Date: Sat, 14 Jun 2008 19:55:10 +0200	[thread overview]
Message-ID: <20080614175510.GA21014@lst.de> (raw)

There are two errors I see all the time in 145:

 - dm_probe_hole returns EINVAL for offsets close to the file size
 - dm_probe_hole wants EAGAIN for a probe at offset 1, length 0


The first error is a consequence of how the hole puching / probing
works.  It always rounds the requested offset up to the next block
size and then checks if that rounded offset still fits into the file
size.  Just do the same rounding in the testcase to make sure we don't
probe invalid offsets.

The second error is very odd to me, as we never return AGAIN in the
whole dm_probe_hole path.  I've just commented it out.

I've also re-enabled the E2BIG to past-EOF test that was uncommented
before because it works perfectly fine now.


Signed-off-by: Christoph Hellwig <hch@lst.de>

--- xfstests/145.out	19 Dec 2006 02:55:36 -0000	1.1
+++ xfstests/145.out	14 Jun 2008 17:49:49 -0000
@@ -16,13 +16,13 @@ Hole test beginning...
 	Verified hole at 4096
 	(beginning errno subtests...)
 	report on test for E2BIG in probe (from past EOF): test successful
+	report on test for E2BIG in probe (to past EOF): test successful
 	report on test for EACCES in no-right probe: test successful
 	report on test for success in SHARED probe: test successful.
 	report on test for success in EXCL probe: test successful.
 	report on test for EACCES in no-right punch: test successful
 	report on test for EACCES in SHARED punch: test successful
 	report on test for success in EXCL punch: test successful.
-	report on test for EAGAIN in punch: test successful
 	report on test for EBADF in probe: test successful
 	report on test for EBADF in punch: test successful
 	report on test for EFAULT in probe (null handle): test successful
--- xfstests/dmapi/src/suite2/src/test_hole.c	9 Nov 2005 02:50:19 -0000	1.8
+++ xfstests/dmapi/src/suite2/src/test_hole.c	14 Jun 2008 17:49:49 -0000
@@ -69,7 +69,7 @@ main(
 	dm_sessid_t	sid = DM_NO_SESSION;
 	char		*pathname = NULL;
 	char		*ls_path = NULL;
-	dm_off_t	offset = 0;
+	dm_off_t	offset = 0, end;
 	dm_off_t	ex_off = 0;
 	dm_extent_t     extent[20];
 	u_int           nelem;
@@ -162,10 +162,16 @@ main(
 	  exit(1);
 	}
 
+	/*
+	 * The kernel always rounds the offset up to the next block
+	 * size, so we can only probes up to the previous to last block.
+	 */
+	end = (29604 / blocksize) * blocksize;
+
 	/* Check that dm_probe_hole returns an extent from the next
 	 * highest multiple of the block size, to the end of the file
 	 */
-	for (offset = 0; offset < 29604; offset++) { 
+	for (offset = 0; offset < end; offset++) { 
 	  if (dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, offset, length,
 			    &roff, &rlen)) {
 	    fprintf(stdout, "dm_probe_hole failed on pass %lld (%s)\n",
@@ -275,15 +281,10 @@ main(
 		dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 30000, length,
 			      &roff, &rlen))
 	/*---------------------------------------------------------*/
-#if 0
-	PROBLEM: No error is produced.  
-	off+len >= filesize should produce E2BIG...
-
 	ERRTEST(E2BIG,
 		"probe (to past EOF)",
 		dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 15000, 150000,
 			      &roff, &rlen))
-#endif
         /*---------------------------------------------------------*/
 	SHAREDTEST("probe", hanp, hlen, test_token, 
 		 dm_probe_hole(sid, hanp, hlen, test_token, 
@@ -292,10 +293,18 @@ main(
 	EXCLTEST("punch", hanp, hlen, test_token, 
 		   dm_punch_hole(sid, hanp, hlen, test_token, 0, 0)) 
 	/*---------------------------------------------------------*/
+	/*
+	 * No idea where that EAGAIN should come from, it's never
+	 * returned from the kernel.
+	 *
+	 * 		-- hch
+	 */
+#if 0
 	ERRTEST(EAGAIN,
 		"punch",
 		dm_punch_hole(sid, hanp, hlen, DM_NO_TOKEN,
 			      1, length))	
+#endif
 	/*---------------------------------------------------------*/
 	if ((test_vp = handle_clone(hanp, hlen)) == NULL) {
 	  fprintf(stderr, 

             reply	other threads:[~2008-06-14 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-14 17:55 Christoph Hellwig [this message]
2008-06-18  7:52 ` [PATCH, RFC] fix XFSQA 145 / test_hole Donald Douwsma

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=20080614175510.GA21014@lst.de \
    --to=hch@lst.de \
    --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