<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Jan,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 19, 2019 at 12:08 AM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">write() returning ENOSPC doesn't guarantee that filesystem after<br>
some internal book-keeping, flushing, finishing transactions, etc.<br>
won't still find some extra space.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Thanks for the patch, I have drafted a similar one but you sent out first :).</div><br></div><div><div class="gmail_default" style="">Another patch I was thinking is to enhance the tst_fill_fs routine, which as Eric suggested, makes more reliably to get to a full filesystem. Something like what xfstest does to cut the trial write size in half and try again until the size is less than the filesystem block size.</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">Comments?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--- a/lib/tst_fill_fs.c<br>+++ b/lib/tst_fill_fs.c<br>@@ -6,6 +6,7 @@<br> #include <errno.h><br> #include <stdio.h><br> #include <stdlib.h><br>+#include <sys/statvfs.h><br> <br> #define TST_NO_DEFAULT_MAIN<br> #include "tst_test.h"<br>@@ -19,6 +20,8 @@ void tst_fill_fs(const char *path, int verbose)<br>        size_t len;<br>        ssize_t ret;<br>        int fd;<br>+       struct statvfs fi;<br>+       statvfs(path, &fi);<br> <br>        for (;;) {<br>                len = random() % (1024 * 102400);<br>@@ -41,6 +44,12 @@ void tst_fill_fs(const char *path, int verbose)<br>                        ret = write(fd, buf, MIN(len, sizeof(buf)));<br> <br>                        if (ret < 0) {<br>+                               if (errno == ENOSPC) {<br>+                                       len /= 2;<br>+                                       if (len >= fi.f_bsize)<br>+                                               continue;<br>+                               }<br>+<br>                                SAFE_CLOSE(fd);<br> <br>                                if (errno != ENOSPC)<br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Increase FALLOCATE_SIZE to minimize chance of hitting sporadic<br>
failures when that happens.<br>
<br>
Thanks to Carlos Maiolino and Eric Sandeen for their comments<br>
and suggestions.<br>
<br>
Fixes #610<br>
Signed-off-by: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br></blockquote><div><span class="gmail_default" style="font-size:small">Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>></span></div><div><span class="gmail_default" style="font-size:small"></span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 testcases/kernel/syscalls/fallocate/fallocate05.c | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c<br>
index 50c610c448ba..17034e5b11e7 100644<br>
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c<br>
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c<br>
@@ -17,7 +17,7 @@<br>
 #include "lapi/fallocate.h"<br>
<br>
 #define MNTPOINT "mntpoint"<br>
-#define FALLOCATE_SIZE 8192<br>
+#define FALLOCATE_SIZE (1024*1024)<br>
 #define TESTED_FLAGS "fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)"<br>
<br>
 static int fd;<br>
-- <br>
1.8.3.1<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>