scst_dlm: Warn if kernel_read() can't read from configfs files

See also upstream commit 7fe1e79b59ba ("configfs: implement the .read_iter
and .write_iter methods"; v5.14).



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9594 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2021-11-04 00:42:39 +00:00
parent 193e63d118
commit 09168f5186
+7
View File
@@ -510,6 +510,13 @@ static int scst_read_file(const char *path, char *buf, int buf_len)
goto out;
}
pos = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
/*
* Commit 4d03e3cc5982 ("fs: don't allow kernel reads and writes
* without iter ops") made kernel_read() depend on .read_iter.
*/
WARN_ON_ONCE(!f->f_op->read_iter);
#endif
ret = kernel_read(f, buf, buf_len, &pos);
if (ret >= 0)
buf[min(ret, buf_len - 1)] = '\0';