Description of problem: The ext3_journalled_aops doesn't define .direct_IO. This causes applications that have O_DIRECT in their open flags fail universally in any ext3 filesystem mounted with "data=journal" mode due to the following checking in dentry_open() called by sys_open -> filp_open route: /* NB: we're sure to have correct a_ops only after f_op->open */ if (f->f_flags & O_DIRECT) { if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO) { fput(f); f = ERR_PTR(-EINVAL); } } static struct address_space_operations ext3_writeback_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_writeback_writepage, .sync_page = block_sync_page, .prepare_write = ext3_prepare_write, .commit_write = ext3_writeback_commit_write, .bmap = ext3_bmap, .invalidatepage = ext3_invalidatepage, .releasepage = ext3_releasepage, .direct_IO = ext3_direct_IO, }; static struct address_space_operations ext3_journalled_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_journalled_writepage, .sync_page = block_sync_page, .prepare_write = ext3_prepare_write, .commit_write = ext3_journalled_commit_write, .set_page_dirty = ext3_journalled_set_page_dirty, .bmap = ext3_bmap, .invalidatepage = ext3_invalidatepage, .releasepage = ext3_releasepage, }; Version-Release number of selected component (if applicable): How reproducible: Each time and everytime. Steps to Reproduce: 1. Mount the filesystem with data=journal mode. 2. Write a test program with O_DIRECT in its flags. 3. Watch the open call return error with "invalid argument". Actual results: Expected results: Additional info: * I'm not really sure this is an oversignt or intentional. * AS2.1 and RHEL 3 do not have this restriction. * Upstream 2.6 kernel does *not* have this functionality either.
I vote we support it :) .. Will enable the call to see whether it will break anything obvious. Be aware that with this restriction, admin can't freely switch between different modes of mount options.
Well, the consensus is that this combination (data=journal and O_DIRECT) doesn't make much sense. We'll work on it if there is really a genuine need. TAM, please pass this comment back to the customer.
To be specific, data=journal says journal all data; O_DIRECT says write data straight to disk. They are in direct conflict. This combination is really an undocumented edge-case between two options. It's not clear that there's any obviously correct interpretation for it; it falls into the undefined grey area between the two options.
IT has been closed, closing the bug too.