On Wed Jan 20, 2021 at 5:56 AM NZDT, Robert Karszniewicz wrote: > > I have bisected this issue down to this commit: > 4d03e3cc5982 ("fs: don't allow kernel reads and writes without iter > ops") > > Another case I've also noticed is writing to a serial connection: > kernel write not supported for file /ttymxc0 (pid: 252 comm: cat) >
Tangentially, I hit the same thing when hacking on this. Here's a diff making the implementation match the comment: --- a/fs/read_write.c +++ b/fs/read_write.c @@ -541,7 +541,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t * Also fail if ->write_iter and ->write are both wired up as that * implies very convoluted semantics. */ - if (unlikely(!file->f_op->write_iter || file->f_op->write)) + if (unlikely(file->f_op->write_iter && file->f_op->write)) return warn_unsupported(file, "write"); init_sync_kiocb(&kiocb, file);