From e038e81fb63849ec43121cca04d8e7ca28861cf2 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 30 Aug 2012 14:52:55 +0000 Subject: [PATCH] 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 --- scst/src/scst_sysfs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 3dcba8bff..6b32fc2aa 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -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);