diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-09 13:52:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:30:22 -0400 |
commit | 2ba48ce513c4e545318d22b138861d5876edf906 (patch) | |
tree | 0e2a5130ead5c71f0b079b1acd620fba98f99256 /mm/filemap.c | |
parent | 3309dd04cbcd2cdad168485af5cf3576b5051e49 (diff) |
mirror O_APPEND and O_DIRECT into iocb->ki_flags
... avoiding write_iter/fcntl races.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 243997a26e7c..405de370e657 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1694,7 +1694,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) | |||
1694 | loff_t *ppos = &iocb->ki_pos; | 1694 | loff_t *ppos = &iocb->ki_pos; |
1695 | loff_t pos = *ppos; | 1695 | loff_t pos = *ppos; |
1696 | 1696 | ||
1697 | if (io_is_direct(file)) { | 1697 | if (iocb->ki_flags & IOCB_DIRECT) { |
1698 | struct address_space *mapping = file->f_mapping; | 1698 | struct address_space *mapping = file->f_mapping; |
1699 | struct inode *inode = mapping->host; | 1699 | struct inode *inode = mapping->host; |
1700 | size_t count = iov_iter_count(iter); | 1700 | size_t count = iov_iter_count(iter); |
@@ -2271,7 +2271,7 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from) | |||
2271 | return 0; | 2271 | return 0; |
2272 | 2272 | ||
2273 | /* FIXME: this is for backwards compatibility with 2.4 */ | 2273 | /* FIXME: this is for backwards compatibility with 2.4 */ |
2274 | if (file->f_flags & O_APPEND) | 2274 | if (iocb->ki_flags & IOCB_APPEND) |
2275 | iocb->ki_pos = i_size_read(inode); | 2275 | iocb->ki_pos = i_size_read(inode); |
2276 | 2276 | ||
2277 | pos = iocb->ki_pos; | 2277 | pos = iocb->ki_pos; |
@@ -2545,7 +2545,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
2545 | if (err) | 2545 | if (err) |
2546 | goto out; | 2546 | goto out; |
2547 | 2547 | ||
2548 | if (io_is_direct(file)) { | 2548 | if (iocb->ki_flags & IOCB_DIRECT) { |
2549 | loff_t pos, endbyte; | 2549 | loff_t pos, endbyte; |
2550 | 2550 | ||
2551 | written = generic_file_direct_write(iocb, from, iocb->ki_pos); | 2551 | written = generic_file_direct_write(iocb, from, iocb->ki_pos); |