vfs.git fixes for -rc2
Al Viro
maintainer A couple of fixes, both -stable fodder. O_SYNC bug is
fairly old... Please, pull from the usual place -git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus
Shortlog:
Al Viro (2):
fix O_SYNC|O_APPEND syncing the wrong range on write() fix a kmap leak in virtio_console
Diffstat:
drivers/char/virtio_console.c | 9 +++------ fs/cifs/file.c | 4 ++-- fs/ext4/file.c | 2 +- fs/ntfs/file.c | 2 +- fs/sync.c | 17 ----------------- fs/xfs/xfs_file.c | 2 +- include/linux/fs.h | 8 +++++++- mm/filemap.c | 4 ++-- 8 files changed, 17 insertions(+), 31 deletions(-)
Quoted 7 lines · Al Viro
A couple of fixes, both -stable fodder.
O_SYNCbug is
fairly old... Please, pull from the usual place -git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.gitfor-linusShortlog:
Al Viro (2):
fix O_SYNC|O_APPEND syncing the wrong range onwrite()
As i pointed out in a private thread this doesn't fix XFS. It passes a private "pos" variable to generic_write_checks() and so iocb->ki_pos never gets updated to point at the new EOF when O_APPEND is set. Hence the code inthe above commit is still syncing the wrong range.
Indeed, I think that __generic_file_aio_write has the same problem. It gets called from generic_file_aio_write() like so:
ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
And __generic_file_aio_write() does this:
pos = *ppos; .... err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
and the updated pos value on O_APPEND writes is never folded back into ppos. Hence the later call to generic_write_sync() still has the wrong range....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 1 line · Dave Chinner
As i pointed out in a private thread this doesn't fix XFS.
Btw, would be nice to have a public discussion and review next time before a pull request appears.
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Dave Chinner
As i pointed out in a private thread this doesn't fix XFS.
Btw, would be nice to have a public discussion and review next time before a pull request appears.
And after review, it can be added to linux-next.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Dave Chinner
As i pointed out in a private thread this doesn't fix XFS.
Btw, would be nice to have a public discussion and review next time before a pull request appears.
The private thread was Al pointing out other O_APPEND related problems in a reply to his pull request, so you haven't missed out on anything. First I knew of this was that private thread....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Al Viro
maintainerQuoted 2 lines · Dave Chinner
and the updated pos value on
O_APPENDwrites is never folded back into ppos.
Not true. Check generic_file_buffered_write() and generic_file_direct_write()
- that's where it's normally stored into iocb->ki_pos (via *ppos). And yes, I agree that the damn thing is obfuscated to hell and back - other commits in my local tree kill 'ppos' arguments of __generic_file_aio_write() and generic_file_buffered_write() (equal to &iocb->ki_pos for all call sites), which makes it a bit easier to keep track of. Will push that part of queue into vfs.git#iov_iter today...