scst_sysfs: Add EAGAIN fault injection code.

To do: update scst/Makefile and scst/README with more information about the
CONFIG_SCST_DEBUG_SYSFS_EAGAIN configuration option.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4499 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-08-30 14:52:55 +00:00
parent f11ebeafe4
commit e038e81fb6

View File

@@ -523,6 +523,23 @@ int scst_sysfs_queue_wait_work(struct scst_sysfs_work_item *work)
"failed: %d", atomic_read(&uid_thread_name),
(int)PTR_ERR(t));
#ifdef CONFIG_SCST_DEBUG_SYSFS_EAGAIN
{
static int cnt;
if (!work->read_only_action || cnt++ % 4 < 3) {
/*
* Helps testing user space code that writes to or
* reads from SCST sysfs variables.
*/
timeout = 0;
rc = 0;
res = -EAGAIN;
goto out_put;
}
}
#endif
while (1) {
rc = wait_for_completion_interruptible_timeout(
&work->sysfs_work_done, timeout);