Skip to content

Commit da98b27

Browse files
committed
[Issue #203] error out if FIO_FDMAX is exceeded in fio_opendir
1 parent 200e47b commit da98b27

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/file.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ DIR* fio_opendir(char const* path, fio_location location)
262262
mask = fio_fdset;
263263
for (i = 0; (mask & 1) != 0; i++, mask >>= 1);
264264
if (i == FIO_FDMAX) {
265-
return NULL;
265+
elog(ERROR, "FIO_FDMAX is exceeded in fio_opendir, "
266+
"probably too many remote directories has been opened");
266267
}
267268
hdr.cop = FIO_OPENDIR;
268269
hdr.handle = i;
@@ -277,6 +278,7 @@ DIR* fio_opendir(char const* path, fio_location location)
277278
if (hdr.arg != 0)
278279
{
279280
errno = hdr.arg;
281+
fio_fdset &= ~(1 << hdr.handle);
280282
return NULL;
281283
}
282284
dir = (DIR*)(size_t)(i + 1);
@@ -349,7 +351,8 @@ int fio_open(char const* path, int mode, fio_location location)
349351
mask = fio_fdset;
350352
for (i = 0; (mask & 1) != 0; i++, mask >>= 1);
351353
if (i == FIO_FDMAX)
352-
elog(ERROR, "FIO_FDMAX is exceeded, probably too many remote files has been opened");
354+
elog(ERROR, "FIO_FDMAX is exceeded in fio_open, "
355+
"probably too many remote files has been opened");
353356

354357
hdr.cop = FIO_OPEN;
355358
hdr.handle = i;

0 commit comments

Comments
 (0)