fence_wdog_log_path_store() returned 0 on success instead of the number
of bytes consumed. A sysfs ->store() handler must return @count (or a
negative error); returning 0 tells the VFS that no bytes of the write
were consumed, so a write(2) of the new path makes no progress. A
libc/shell that loops until all bytes are written (e.g. echo > file)
then spins forever, and a single write() reports 0 rather than the
requested length. The path value itself is updated (sscanf ran), which
masks the bug on a casual read-back, but the write side is broken.
The sibling watchdog_timer and watchdog_action store handlers already
return count; do the same here.
Fixes: 9cf3dd3bae58 ("fence-watchdog: Add fence-watchdog driver")
Feature: kernel: fense watchdog driver
https://virtuozzo.atlassian.net/browse/VSTOR-137234
Signed-off-by: Konstantin Khorenko <[email protected]>
---
kernel/fence-watchdog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/fence-watchdog.c b/kernel/fence-watchdog.c
index bcbd439d4981..c7a28fad1f26 100644
--- a/kernel/fence-watchdog.c
+++ b/kernel/fence-watchdog.c
@@ -279,7 +279,7 @@ static ssize_t fence_wdog_log_path_store(struct kobject
*kobj,
if (sscanf(buf, format, fence_wdog_log_path) != 1)
return -EINVAL;
- return 0;
+ return count;
}
static struct kobj_attribute fence_wdog_timer_attr =
--
2.47.1
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel