Skip to contentSkip to conversation

xfstests: fix seek_sanity_test for fs w/o fallocate

PATCH In review Eric Sandeen 4 participants 7 messages May 31, 2013 – Jun 3, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fix seek_sanity_test for fs w/o fallocate

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

---

src/seek_sanity_test.c +26 -4
index cd3b1ee..fbf5a8c 100644
@@ -96,9 +96,13 @@ static int do_fallocate(int fd, off_t offset, off_t length, int mode)
 	int ret;
 
 	ret = fallocate(fd, mode, offset, length);
-	if (ret)
+	if (ret) {
+		/* Don't warn about a filesystem w/o fallocate support */
+		if (errno == EOPNOTSUPP)
+			return ret;
 		fprintf(stderr, "  ERROR %d: Failed to preallocate "
 			"space to %ld bytes\n", errno, (long) length);
+	}
 
 	return ret;
 }
@@ -290,8 +294,14 @@ static int test09(int fd, int testnum)
 
 	/* preallocate 8M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (!ret) {
@@ -336,8 +346,14 @@ static int test08(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)
@@ -379,8 +395,14 @@ static int test07(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 3 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Hi Eric,

I remember that my patch had been applied [1]. But stranger I couldn't find it in xfstests tree. However, I think that your patch is better.

1. http://oss.sgi.com/archives/xfs/2013-05/msg00534.html

- Zheng

Quoted 76 lines

---

src/seek_sanity_test.c +26 -4
index cd3b1ee..fbf5a8c 100644
@@ -96,9 +96,13 @@ static int do_fallocate(int fd, off_t offset, off_t length, int mode)
 	int ret;
 
 	ret = fallocate(fd, mode, offset, length);
-	if (ret)
+	if (ret) {
+		/* Don't warn about a filesystem w/o fallocate support */
+		if (errno == EOPNOTSUPP)
+			return ret;
 		fprintf(stderr, "  ERROR %d: Failed to preallocate "
 			"space to %ld bytes\n", errno, (long) length);
+	}
 
 	return ret;
 }
@@ -290,8 +294,14 @@ static int test09(int fd, int testnum)
 
 	/* preallocate 8M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (!ret) {
@@ -336,8 +346,14 @@ static int test08(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)
@@ -379,8 +395,14 @@ static int test07(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 11 lines · Zheng Liu
Quoted 3 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Hi Eric,

I remember that my patch had been applied [1]. But stranger I couldn't find it in xfstests tree. However, I think that your patch is better.

1. http://oss.sgi.com/archives/xfs/2013-05/msg00534.html

Oh, right, I had forgotten about that. Rich, any idea?

I don't care which patch goes in....

-Eric

Quoted 78 lines

- Zheng

Quoted 76 lines

---

src/seek_sanity_test.c +26 -4
index cd3b1ee..fbf5a8c 100644
@@ -96,9 +96,13 @@ static int do_fallocate(int fd, off_t offset, off_t length, int mode)
 	int ret;
 
 	ret = fallocate(fd, mode, offset, length);
-	if (ret)
+	if (ret) {
+		/* Don't warn about a filesystem w/o fallocate support */
+		if (errno == EOPNOTSUPP)
+			return ret;
 		fprintf(stderr, "  ERROR %d: Failed to preallocate "
 			"space to %ld bytes\n", errno, (long) length);
+	}
 
 	return ret;
 }
@@ -290,8 +294,14 @@ static int test09(int fd, int testnum)
 
 	/* preallocate 8M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (!ret) {
@@ -336,8 +346,14 @@ static int test08(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)
@@ -379,8 +395,14 @@ static int test07(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 6 lines · Eric Sandeen
Quoted 5 lines · Zheng Liu
Quoted 3 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Quoted 8 lines
Quoted 6 lines

Hi Eric,

I remember that my patch had been applied [1]. But stranger I couldn't find it in xfstests tree. However, I think that your patch is better.

1. http://oss.sgi.com/archives/xfs/2013-05/msg00534.html

Oh, right, I had forgotten about that. Rich, any idea?

No other than it was a Friday. My apologies Zheng.
Zheng as your's should have been committed, what do you want me to do?

--Rich

Quoted 5 lines

I don't care which patch goes in....

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 12 lines · Rich Johnston
Quoted 11 lines · Eric Sandeen
Quoted 10 lines · Zheng Liu
Quoted 3 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Hi Eric,

I remember that my patch had been applied [1]. But stranger I couldn't find it in xfstests tree. However, I think that your patch is better.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

1. http://oss.sgi.com/archives/xfs/2013-05/msg00534.html

Oh, right, I had forgotten about that. Rich, any idea?

No other than it was a Friday. My apologies Zheng.
Zheng as your's should have been committed, what do you want me to do?

Actually let's merge mine since it allows testing on ext2/3. The other just disables those filesystems...

-Eric

Quoted 12 lines

--Rich

Quoted 4 lines

I don't care which patch goes in....

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw
In reply to Rich Johnston
Quoted 12 lines · 在 2013-6-1,上午3:02,Rich Johnston <[email protected]> 写道:
Quoted 11 lines · Eric Sandeen
Quoted 10 lines · Zheng Liu
Quoted 3 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Hi Eric,

I remember that my patch had been applied [1]. But stranger I couldn't find it in xfstests tree. However, I think that your patch is better.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

1. http://oss.sgi.com/archives/xfs/2013-05/msg00534.html

Oh, right, I had forgotten about that. Rich, any idea?

No other than it was a Friday. My apologies Zheng.
Zheng as your's should have been committed, what do you want me to do?

Hi Rich,

Sorry for my late reply. As Eric said, please apply his patch because it is better.

Thanks,
- Zheng
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw
In reply to Eric Sandeen
Quoted 5 lines · Eric Sandeen

currently the seek_sanity_test (generic/285) fails on ext3 or ext2 due to fallocate() failures. Just ignore that test if the fs doesn't support fallocate.

Thanks Eric and Zheng, this has been committed.

commit 3e889c6735117e0906c339ffae0dbc17a4df27fb

Author: Eric Sandeen <[email protected]>
Date:   Mon Jun 3 07:28:17 2013 -0500

xfstests: fix seek_sanity_test for fs w/o fallocate

(Rich adds another step to his commit procedure to prevent this from happening again)

--Rich

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs