From 09168f5186b1a70ada058cd1c2db1e1bd65c4737 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 4 Nov 2021 00:42:39 +0000 Subject: [PATCH] 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 --- scst/src/scst_dlm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scst/src/scst_dlm.c b/scst/src/scst_dlm.c index dff421cb7..5a4e7c728 100644 --- a/scst/src/scst_dlm.c +++ b/scst/src/scst_dlm.c @@ -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';