Index: cpukit/libblock/src/blkdev.c
===================================================================
--- cpukit/libblock/src/blkdev.c	(revision 694c3ac6820543a881b5083173c5435e9b4d3a32)
+++ cpukit/libblock/src/blkdev.c	(revision bdac0eed0c2acf442db943d116f53b8e0f7d2c3e)
@@ -34,31 +34,20 @@
 rtems_device_driver
 rtems_blkdev_generic_read(
-    rtems_device_major_number major,
-    rtems_device_minor_number minor,
+    rtems_device_major_number major __attribute__((unused)),
+    rtems_device_minor_number minor __attribute__((unused)),
     void                    * arg)
 {
     rtems_status_code rc = RTEMS_SUCCESSFUL;
     rtems_libio_rw_args_t *args = arg;
-    uint32_t block_size;
-    char *buf;
-    uint32_t count;
-    rtems_blkdev_bnum block;
-    uint32_t blkofs;
-    dev_t dev;
-    rtems_disk_device *dd;
-
-    dev = rtems_filesystem_make_dev_t(major, minor);
-    dd = rtems_disk_obtain(dev);
-    if (dd == NULL)
-        return RTEMS_INVALID_NUMBER;
-
-    block_size = dd->block_size;
-
-    buf = args->buffer;
-    count = args->count;
+    rtems_libio_t *iop = args->iop;
+    rtems_disk_device *dd = iop->data1;
+    uint32_t block_size = dd->block_size;
+    char *buf = args->buffer;
+    uint32_t count = args->count;
+    rtems_blkdev_bnum block = (rtems_blkdev_bnum) (args->offset / block_size);
+    uint32_t blkofs = (uint32_t) (args->offset % block_size);
+    dev_t dev = dd->dev;
+
     args->bytes_moved = 0;
-
-    block = (rtems_blkdev_bnum) (args->offset / block_size);
-    blkofs = (uint32_t) (args->offset % block_size);
 
     while (count > 0)
@@ -84,6 +73,4 @@
     }
 
-    rtems_disk_release(dd);
-
     return rc;
 }
@@ -95,31 +82,20 @@
 rtems_device_driver
 rtems_blkdev_generic_write(
-    rtems_device_major_number major,
-    rtems_device_minor_number minor,
+    rtems_device_major_number major __attribute__((unused)),
+    rtems_device_minor_number minor __attribute__((unused)),
     void                    * arg)
 {
     rtems_status_code rc = RTEMS_SUCCESSFUL;
     rtems_libio_rw_args_t *args = arg;
-    uint32_t block_size;
-    char *buf;
-    uint32_t count;
-    rtems_blkdev_bnum block;
-    uint32_t blkofs;
-    dev_t dev;
-    rtems_disk_device *dd;
-
-    dev = rtems_filesystem_make_dev_t(major, minor);
-    dd = rtems_disk_obtain(dev);
-    if (dd == NULL)
-        return RTEMS_INVALID_NUMBER;
-
-    block_size = dd->block_size;
-
-    buf = args->buffer;
-    count = args->count;
+    rtems_libio_t *iop = args->iop;
+    rtems_disk_device *dd = iop->data1;
+    uint32_t block_size = dd->block_size;
+    char *buf = args->buffer;
+    uint32_t count = args->count;
+    rtems_blkdev_bnum block = (rtems_blkdev_bnum) (args->offset / block_size);
+    uint32_t blkofs = (uint32_t) (args->offset % block_size);
+    dev_t dev = dd->dev;
+
     args->bytes_moved = 0;
-
-    block = (rtems_blkdev_bnum) (args->offset / block_size);
-    blkofs = (uint32_t) (args->offset % block_size);
 
     while (count > 0)
@@ -151,6 +127,4 @@
     }
 
-    rtems_disk_release(dd);
-
     return rc;
 }
@@ -163,19 +137,17 @@
     rtems_device_major_number major,
     rtems_device_minor_number minor,
-    void                    * arg __attribute__((unused)))
-{
-    dev_t dev;
-    rtems_disk_device *dd;
-
-    dev = rtems_filesystem_make_dev_t(major, minor);
-    dd = rtems_disk_obtain(dev);
-    if (dd == NULL)
-        return RTEMS_INVALID_NUMBER;
-
-    dd->uses++;
-
-    rtems_disk_release(dd);
-
+    void                    * arg)
+{
+  rtems_libio_open_close_args_t *oc = arg;
+  rtems_libio_t *iop = oc->iop;
+  dev_t dev = rtems_filesystem_make_dev_t(major, minor);
+  rtems_disk_device *dd = rtems_disk_obtain(dev);
+
+  iop->data1 = dd;
+
+  if (dd != NULL)
     return RTEMS_SUCCESSFUL;
+  else
+    return RTEMS_UNSATISFIED;
 }
 
@@ -186,21 +158,15 @@
 rtems_device_driver
 rtems_blkdev_generic_close(
-    rtems_device_major_number major,
-    rtems_device_minor_number minor,
-    void                    * arg __attribute__((unused)))
-{
-    dev_t dev;
-    rtems_disk_device *dd;
-
-    dev = rtems_filesystem_make_dev_t(major, minor);
-    dd = rtems_disk_obtain(dev);
-    if (dd == NULL)
-        return RTEMS_INVALID_NUMBER;
-
-    dd->uses--;
-
-    rtems_disk_release(dd);
-
-    return RTEMS_SUCCESSFUL;
+    rtems_device_major_number major __attribute__((unused)),
+    rtems_device_minor_number minor __attribute__((unused)),
+    void                    * arg)
+{
+  rtems_libio_open_close_args_t *oc = arg;
+  rtems_libio_t *iop = oc->iop;
+  rtems_disk_device *dd = iop->data1;
+
+  rtems_disk_release(dd);
+
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -210,17 +176,12 @@
 rtems_device_driver
 rtems_blkdev_generic_ioctl(
-    rtems_device_major_number major,
-    rtems_device_minor_number minor,
+    rtems_device_major_number major __attribute__((unused)),
+    rtems_device_minor_number minor __attribute__((unused)),
     void                    * arg)
 {
     rtems_libio_ioctl_args_t *args = arg;
-    dev_t dev;
-    rtems_disk_device *dd;
+    rtems_libio_t *iop = args->iop;
+    rtems_disk_device *dd = iop->data1;
     int rc;
-
-    dev = rtems_filesystem_make_dev_t(major, minor);
-    dd = rtems_disk_obtain(dev);
-    if (dd == NULL)
-        return RTEMS_INVALID_NUMBER;
 
     switch (args->command)
@@ -256,6 +217,5 @@
              * the cache.
              */
-            rc = RTEMS_INVALID_NAME;
-            args->ioctl_return = -1;
+            args->ioctl_return = (uint32_t) -1;
             break;
 
@@ -266,5 +226,4 @@
             break;
     }
-    rtems_disk_release(dd);
 
     return RTEMS_SUCCESSFUL;
Index: cpukit/libblock/src/diskdevs.c
===================================================================
--- cpukit/libblock/src/diskdevs.c	(revision 694c3ac6820543a881b5083173c5435e9b4d3a32)
+++ cpukit/libblock/src/diskdevs.c	(revision bdac0eed0c2acf442db943d116f53b8e0f7d2c3e)
@@ -90,5 +90,5 @@
 
 static rtems_disk_device *
-get_disk_entry(dev_t dev)
+get_disk_entry(dev_t dev, bool lookup_only)
 {
   rtems_device_major_number major = 0;
@@ -103,9 +103,13 @@
       rtems_disk_device *dd = dtab->minor [minor];
 
-      if (dd != NULL && !dd->deleted) {
-        ++dd->uses;
-
-        return dd;
+      if (dd != NULL && !lookup_only) {
+        if (!dd->deleted) {
+          ++dd->uses;
+        } else {
+          dd = NULL;
+        }
       }
+
+      return dd;
     }
   }
@@ -289,9 +293,6 @@
   }
 
-  physical_disk = get_disk_entry(phys);
+  physical_disk = get_disk_entry(phys, true);
   if (physical_disk == NULL || !is_physical_disk(physical_disk)) {
-    if (physical_disk != NULL) {
-      --physical_disk->uses;
-    }
     disk_unlock();
 
@@ -304,5 +305,4 @@
       || end_block > physical_disk->size
   ) {
-    --physical_disk->uses;
     disk_unlock();
 
@@ -312,5 +312,4 @@
   sc = create_disk(dev, name, &dd);
   if (sc != RTEMS_SUCCESSFUL) {
-    --physical_disk->uses;
     disk_unlock();
 
@@ -324,4 +323,6 @@
   dd->ioctl = physical_disk->ioctl;
   dd->driver_data = physical_disk->driver_data;
+
+  ++physical_disk->uses;
 
   disk_unlock();
@@ -399,5 +400,5 @@
   }
 
-  dd = get_disk_entry(dev);
+  dd = get_disk_entry(dev, true);
   if (dd == NULL) {
     disk_unlock();
@@ -406,5 +407,4 @@
   }
 
-  --dd->uses;
   dd->deleted = true;
   rtems_disk_cleanup(dd);
@@ -425,5 +425,5 @@
   if (!diskdevs_protected) {
     /* Frequent and quickest case */
-    dd = get_disk_entry(dev);
+    dd = get_disk_entry(dev, false);
     rtems_interrupt_enable(level);
   } else {
@@ -432,5 +432,5 @@
     sc = disk_lock();
     if (sc == RTEMS_SUCCESSFUL) {
-      dd = get_disk_entry(dev);
+      dd = get_disk_entry(dev, false);
       disk_unlock();
     }
