hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/Documentation/fault-injection/fault-injection.rst
....@@ -78,8 +78,8 @@
7878
7979 - /sys/kernel/debug/fail*/times:
8080
81
- specifies how many times failures may happen at most.
82
- A value of -1 means "no limit".
81
+ specifies how many times failures may happen at most. A value of -1
82
+ means "no limit".
8383
8484 - /sys/kernel/debug/fail*/space:
8585
....@@ -167,11 +167,13 @@
167167 - ERRNO: retval must be -1 to -MAX_ERRNO (-4096).
168168 - ERR_NULL: retval must be 0 or -1 to -MAX_ERRNO (-4096).
169169
170
-- /sys/kernel/debug/fail_function/<functiuon-name>/retval:
170
+- /sys/kernel/debug/fail_function/<function-name>/retval:
171171
172
- specifies the "error" return value to inject to the given
173
- function for given function. This will be created when
174
- user specifies new injection entry.
172
+ specifies the "error" return value to inject to the given function.
173
+ This will be created when the user specifies a new injection entry.
174
+ Note that this file only accepts unsigned values. So, if you want to
175
+ use a negative errno, you better use 'printf' instead of 'echo', e.g.:
176
+ $ printf %#x -12 > retval
175177
176178 Boot option
177179 ^^^^^^^^^^^
....@@ -336,7 +338,7 @@
336338 FAILTYPE=fail_function
337339 FAILFUNC=open_ctree
338340 echo $FAILFUNC > /sys/kernel/debug/$FAILTYPE/inject
339
- echo -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval
341
+ printf %#x -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval
340342 echo N > /sys/kernel/debug/$FAILTYPE/task-filter
341343 echo 100 > /sys/kernel/debug/$FAILTYPE/probability
342344 echo 0 > /sys/kernel/debug/$FAILTYPE/interval