From 1b7fe6422cb6150dd8cc4ba4fbc6ff810aaa6bb4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 15 May 2021 02:33:31 +0000 Subject: [PATCH] scst_vdisk: Convert several comments into lockdep_assert_held() statements git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9387 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 406fe9a25..36fda650a 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -714,13 +714,14 @@ out: return res; } -/* scst_vdisk_mutex supposed to be held */ static struct scst_vdisk_dev *vdev_find(const char *name) { struct scst_vdisk_dev *res, *vv; TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + res = NULL; list_for_each_entry(vv, &vdev_list, vdev_list_entry) { if (strcmp(vv->name, name) == 0) { @@ -6832,7 +6833,6 @@ static void vdev_inq_changed_fn(struct work_struct *work) return; } -/* scst_vdisk_mutex supposed to be held */ static int vdev_create_node(struct scst_dev_type *devt, const char *name, int nodeid, struct scst_vdisk_dev **res_virt_dev) { @@ -6840,6 +6840,8 @@ static int vdev_create_node(struct scst_dev_type *devt, struct scst_vdisk_dev *virt_dev, *vv; uint64_t dev_id_num; + lockdep_assert_held(&scst_vdisk_mutex); + res = -EEXIST; if (vdev_find(name)) goto out; @@ -7239,7 +7241,6 @@ out: return res; } -/* scst_vdisk_mutex supposed to be held */ static int vdev_fileio_add_device(const char *device_name, char *params) { int res = 0; @@ -7247,6 +7248,8 @@ static int vdev_fileio_add_device(const char *device_name, char *params) TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + res = vdev_create(&vdisk_file_devtype, device_name, &virt_dev); if (res != 0) goto out; @@ -7302,7 +7305,6 @@ out_destroy: goto out; } -/* scst_vdisk_mutex supposed to be held */ static int vdev_blockio_add_device(const char *device_name, char *params) { int res = 0; @@ -7310,6 +7312,8 @@ static int vdev_blockio_add_device(const char *device_name, char *params) TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + res = vdev_create(&vdisk_blk_devtype, device_name, &virt_dev); if (res != 0) goto out; @@ -7366,7 +7370,6 @@ out_destroy: goto out; } -/* scst_vdisk_mutex supposed to be held */ static int vdev_nullio_add_device(const char *device_name, char *params) { int res = 0; @@ -7374,6 +7377,8 @@ static int vdev_nullio_add_device(const char *device_name, char *params) TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + res = vdev_create(&vdisk_null_devtype, device_name, &virt_dev); if (res != 0) goto out; @@ -7490,11 +7495,12 @@ static void vdev_on_free(struct scst_device *dev, void *arg) cancel_work_sync(&virt_dev->vdev_inq_changed_work); } -/* scst_vdisk_mutex supposed to be held */ static void vdev_del_device(struct scst_vdisk_dev *virt_dev) { TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + scst_unregister_virtual_device(virt_dev->virt_id, vdev_on_free, virt_dev); @@ -7537,7 +7543,6 @@ out: return res; } -/* scst_vdisk_mutex supposed to be held */ static ssize_t __vcdrom_add_device(const char *device_name, char *params) { int res = 0; @@ -7545,6 +7550,8 @@ static ssize_t __vcdrom_add_device(const char *device_name, char *params) TRACE_ENTRY(); + lockdep_assert_held(&scst_vdisk_mutex); + res = vdev_create(&vcdrom_devtype, device_name, &virt_dev); if (res != 0) goto out;