From 15033c44c6652cec90727011ef19f755573c045e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 28 Aug 2020 04:16:28 +0000 Subject: [PATCH] scst: Fix the RHEL 6 / 7 kernel_write() backport This patch unbreaks persistent reservation support. Fixes: 94018a42e35b ("scst: Use kernel_{read,write}() instead of scst_{read,write}()") Reported-by: Gleb Chesnokov git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9121 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 5c7b9cdec..9aa63dbc6 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -524,7 +524,12 @@ kernel_write_backport(struct file *file, const void *buf, size_t count, loff_t *pos) { #ifndef CONFIG_SUSE_KERNEL - return kernel_write(file, buf, count, *pos); + int res = kernel_write(file, buf, count, *pos); + + if (res > 0) + *pos += res; + + return res; #else return kernel_write(file, buf, count, pos); #endif