Whamcloud - gitweb
fixed a refcount bug for types.
[fs/lustre-release.git] / lustre / obdclass / class_obd.c
index f597be7..68d586f 100644 (file)
@@ -74,7 +74,7 @@ static int obd_class_open(struct inode * inode, struct file * file)
        if (dev >= MAX_OBD_DEVICES)
                return -ENODEV;
        obd_dev[dev].obd_refcnt++;
-       CDEBUG(D_PSDEV, "Refcount now %d\n", obd_dev[dev].obd_refcnt++);
+       CDEBUG(D_PSDEV, "Refcount now %d\n", obd_dev[dev].obd_refcnt);
 
         MOD_INC_USE_COUNT;
         EXIT;
@@ -94,12 +94,11 @@ static int obd_class_release(struct inode * inode, struct file * file)
                return -ENODEV;
        fsync_dev(inode->i_rdev);
        if (obd_dev[dev].obd_refcnt <= 0)
-               printk(KERN_ALERT "presto_psdev_release: refcount(%d) <= 0\n",
+               printk(KERN_ALERT "obd_class_release: refcount(%d) <= 0\n",
                       obd_dev[dev].obd_refcnt);
        obd_dev[dev].obd_refcnt--;
 
-       CDEBUG(D_PSDEV, "Refcount now %d\n", obd_dev[dev].obd_refcnt++);
-
+       CDEBUG(D_PSDEV, "Refcount now %d\n", obd_dev[dev].obd_refcnt);
         MOD_DEC_USE_COUNT;
 
         EXIT;
@@ -452,6 +451,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                       obddev->obd_type->typ_name);
                if ( !obddev->obd_type->typ_ops || 
                     !obddev->obd_type->typ_ops->o_setup ) {
+                       obddev->obd_type->typ_refcnt++;
                        obddev->obd_flags |= OBD_SET_UP;
                        return 0;
                }