From fb0ad0b8cd854585f7362ce023209dbd0f1477e7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 20 Apr 2016 04:00:00 +0000 Subject: [PATCH] scst_user: improve backward compatibility with handlers relying on obsolete SCST_USER_UNREGISTER_DEVICE call git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6863 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index dc2e7e7a3..33a2cc7ed 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -3533,9 +3533,23 @@ out_put: static int dev_user_unregister_dev(struct file *file) { + struct scst_user_dev *dev; + int res; + + dev = file->private_data; + res = dev_user_check_reg(dev); + if (unlikely(res != 0)) + goto out; + PRINT_WARNING("SCST_USER_UNREGISTER_DEVICE is obsolete and NOOP. " "Closing fd should be used instead."); - return 0; + + /* For backward compatibility unblock possibly blocked sync threads */ + dev->blocking = 0; + wake_up_all(&dev->udev_cmd_threads.cmd_list_waitQ); + +out: + return res; } static int dev_user_flush_cache(struct file *file)