When opening a new file, check file limit not total number
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index fead400cd7c5759d34ad2210f06c5ecee0335145..8f0cdff718e70267c5a330b7aba9f439c09847ca 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -481,13 +481,13 @@ set_file:
                 * probably not the right place to do this, but see
                 * if we need to open a new file
                 */
-               if (td->nr_open_files < td->nr_files &&
+               if (td->nr_open_files < td->open_files &&
                    td->open_files != td->nr_files) {
                        f = find_next_new_file(td);
 
                        if (!f || (ret = td_io_open_file(td, f))) {
                                put_io_u(td, io_u);
-                               break;
+                               return NULL;
                        }
                        goto set_file;
                }