Index: cpukit/libcsupport/include/rtems/libio_.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio_.h	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ cpukit/libcsupport/include/rtems/libio_.h	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -67,5 +67,6 @@
 extern const uint32_t rtems_libio_number_iops;
 extern rtems_libio_t rtems_libio_iops[];
-extern rtems_libio_t *rtems_libio_iop_freelist;
+extern void *rtems_libio_iop_free_head;
+extern void **rtems_libio_iop_free_tail;
 
 extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
Index: cpukit/libcsupport/src/libio.c
===================================================================
--- cpukit/libcsupport/src/libio.c	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ cpukit/libcsupport/src/libio.c	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -109,12 +109,19 @@
 rtems_libio_t *rtems_libio_allocate( void )
 {
-  rtems_libio_t *iop = NULL;
+  rtems_libio_t *iop;
 
   rtems_libio_lock();
 
-  if (rtems_libio_iop_freelist) {
-    iop = rtems_libio_iop_freelist;
-    rtems_libio_iop_freelist = iop->data1;
-    memset( iop, 0, sizeof(*iop) );
+  iop = rtems_libio_iop_free_head;
+
+  if ( iop != NULL ) {
+    void *next;
+
+    next = iop->data1;
+    rtems_libio_iop_free_head = next;
+
+    if ( next == NULL ) {
+      rtems_libio_iop_free_tail = &rtems_libio_iop_free_head;
+    }
   }
 
@@ -132,7 +139,7 @@
   rtems_libio_lock();
 
-    iop->flags = 0;
-    iop->data1 = rtems_libio_iop_freelist;
-    rtems_libio_iop_freelist = iop;
+  iop = memset( iop, 0, sizeof( *iop ) );
+  *rtems_libio_iop_free_tail = iop;
+  rtems_libio_iop_free_tail = &iop->data1;
 
   rtems_libio_unlock();
Index: cpukit/libcsupport/src/libio_init.c
===================================================================
--- cpukit/libcsupport/src/libio_init.c	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ cpukit/libcsupport/src/libio_init.c	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -39,6 +39,9 @@
  */
 
-rtems_id           rtems_libio_semaphore;
-rtems_libio_t     *rtems_libio_iop_freelist;
+rtems_id rtems_libio_semaphore;
+
+void *rtems_libio_iop_free_head;
+
+void **rtems_libio_iop_free_tail = &rtems_libio_iop_free_head;
 
 static void rtems_libio_init( void )
@@ -51,8 +54,9 @@
     if (rtems_libio_number_iops > 0)
     {
-        iop = rtems_libio_iop_freelist = &rtems_libio_iops[0];
+        iop = rtems_libio_iop_free_head = &rtems_libio_iops[0];
         for (i = 0 ; (i + 1) < rtems_libio_number_iops ; i++, iop++)
           iop->data1 = iop + 1;
         iop->data1 = NULL;
+        rtems_libio_iop_free_tail = &iop->data1;
     }
 
Index: cpukit/libcsupport/src/resource_snapshot.c
===================================================================
--- cpukit/libcsupport/src/resource_snapshot.c	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ cpukit/libcsupport/src/resource_snapshot.c	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -88,5 +88,5 @@
   rtems_libio_lock();
 
-  iop = rtems_libio_iop_freelist;
+  iop = rtems_libio_iop_free_head;
   while (iop != NULL) {
     ++free_count;
Index: testsuites/fstests/fsclose01/init.c
===================================================================
--- testsuites/fstests/fsclose01/init.c	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ testsuites/fstests/fsclose01/init.c	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -406,4 +406,25 @@
 }
 
+static void test_fd_free_fifo(const char *path)
+{
+  int a;
+  int b;
+  int rv;
+
+  a = open(path, O_RDWR);
+  rtems_test_assert(a >= 0);
+
+  rv = close(a);
+  rtems_test_assert(rv == 0);
+
+  b = open(path, O_RDWR);
+  rtems_test_assert(b >= 0);
+
+  rv = close(b);
+  rtems_test_assert(rv == 0);
+
+  rtems_test_assert(a != b);
+}
+
 static void test(test_context *ctx)
 {
@@ -420,4 +441,6 @@
   );
   rtems_test_assert(rv == 0);
+
+  test_fd_free_fifo(path);
 
   sc = rtems_task_create(
@@ -470,13 +493,13 @@
   rtems_test_assert(rv == 0);
 
-  rtems_test_assert(ctx->close_count == 15);
+  rtems_test_assert(ctx->close_count == 17);
   rtems_test_assert(ctx->fcntl_count == 1);
   rtems_test_assert(ctx->fdatasync_count == 1);
-  rtems_test_assert(ctx->fstat_count == 38);
+  rtems_test_assert(ctx->fstat_count == 42);
   rtems_test_assert(ctx->fsync_count == 1);
   rtems_test_assert(ctx->ftruncate_count == 1);
   rtems_test_assert(ctx->ioctl_count == 1);
   rtems_test_assert(ctx->lseek_count == 1);
-  rtems_test_assert(ctx->open_count == 15);
+  rtems_test_assert(ctx->open_count == 17);
   rtems_test_assert(ctx->read_count == 1);
   rtems_test_assert(ctx->readv_count == 1);
@@ -496,5 +519,5 @@
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
 
 #define CONFIGURE_MAXIMUM_TASKS 2
Index: testsuites/libtests/termios01/init.c
===================================================================
--- testsuites/libtests/termios01/init.c	(revision baef823cd550449bfbcc36625b9571389d8ad1af)
+++ testsuites/libtests/termios01/init.c	(revision ac741625b0926a0329627beca52174edd69e587b)
@@ -624,4 +624,5 @@
   int fd;
   int rv;
+  int i;
 
   rtems_resource_snapshot_take( &snapshot );
@@ -630,8 +631,14 @@
   rtems_test_assert( sc == RTEMS_SUCCESSFUL );
 
-  errno = 0;
-  fd = open( &dev[0], O_RDWR );
-  rtems_test_assert( fd == -1 );
-  rtems_test_assert( errno == ENXIO );
+  /*
+   * The loop ensures that file descriptor 0 is the first free file descriptor
+   * after this test case.
+   */
+  for (i = 0; i < 4; ++i) {
+    errno = 0;
+    fd = open( &dev[0], O_RDWR );
+    rtems_test_assert( fd == -1 );
+    rtems_test_assert( errno == ENXIO );
+  }
 
   rv = unlink( &dev[0] );
