vfs: added better file aio_read aio_write operations presence check
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Manish Katiyar
On Tue, Sep 16, 2008 at 2:59 PM, Marco Stornelli
Quoted 9 lines
From: Marco Stornelli <[email protected]>
If a filesystem in the file operations specifies for read and write operations only
do_sync_readanddo_sync_writewithout initaio_readandaio_write, there will be a kernel oops, because the vfs code check the presence of (to read for example) read ORaio_readmethod, then it calls read if it's pointer is not null. It's not sufficient because if the read function is actually ado_sync_read, it callsaio_readbut without checking the presence. I think aBUG_ONcheck can be more useful.Instead of doing a
BUG_ON()why can't we simply fall back to thegeneric_aiofunctions since most of the fs tend to do so as below.---
a/fs/read_write.c
Review
Quoted 5 lines
(quoted diff) +4
-1- ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); + if (filp->f_op->aio_read) + ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); + else + ret = generic_file_aio_read(&kiocb, &iov, 1, kiocb.ki_pos);
Why can't the file system registration code set filp->f_op->aio_read to generic_file_aio_read?
Quoted 2 lines · Bodo Eggert
Why can't the file system registration code set
filp->f_op->aio_readtogeneric_file_aio_read?
const struct file_operations *f_op;
Having said that, BUILD_BUG_ON(!f_op->aio_read) is fine by me ... make the filesystem writer put it in without slowing down anyone at runtime.
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."