kernel - Move dsched_disk_destroy_callback() call
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Nov 2012 23:30:35 +0000 (15:30 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Nov 2012 23:30:35 +0000 (15:30 -0800)
* Move the dsched_disk_destroy_callback() call from the caller to the
  message handler to avoid racing a disk probe that might be running at
  the time (if a disk device is added and destroyed quickly).

sys/kern/subr_disk.c

index 6167227..8a9c569 100644 (file)
@@ -483,6 +483,7 @@ disk_msg_core(void *arg)
                                    "DISK_DISK_DESTROY: %s\n",
                                        dp->d_cdev->si_name);
                        disk_iocom_uninit(dp);
+                       dsched_disk_destroy_callback(dp);
                        devfs_destroy_related(dp->d_cdev);
                        destroy_dev(dp->d_cdev);
                        destroy_only_dev(dp->d_rawdev);
@@ -816,7 +817,6 @@ disk_setdiskinfo_sync(struct disk *disk, struct disk_info *info)
 void
 disk_destroy(struct disk *disk)
 {
-       dsched_disk_destroy_callback(disk);
        disk_msg_send_sync(DISK_DISK_DESTROY, disk, NULL);
        return;
 }