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 /fs/ceph | |
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 'fs/ceph')
-rw-r--r-- | fs/ceph/file.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 3f0b9339d823..b9b8eb225f66 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -457,7 +457,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, | |||
457 | if (ret < 0) | 457 | if (ret < 0) |
458 | return ret; | 458 | return ret; |
459 | 459 | ||
460 | if (file->f_flags & O_DIRECT) { | 460 | if (iocb->ki_flags & IOCB_DIRECT) { |
461 | while (iov_iter_count(i)) { | 461 | while (iov_iter_count(i)) { |
462 | size_t start; | 462 | size_t start; |
463 | ssize_t n; | 463 | ssize_t n; |
@@ -828,7 +828,7 @@ again: | |||
828 | return ret; | 828 | return ret; |
829 | 829 | ||
830 | if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || | 830 | if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || |
831 | (iocb->ki_filp->f_flags & O_DIRECT) || | 831 | (iocb->ki_flags & IOCB_DIRECT) || |
832 | (fi->flags & CEPH_F_SYNC)) { | 832 | (fi->flags & CEPH_F_SYNC)) { |
833 | 833 | ||
834 | dout("aio_sync_read %p %llx.%llx %llu~%u got cap refs on %s\n", | 834 | dout("aio_sync_read %p %llx.%llx %llu~%u got cap refs on %s\n", |
@@ -995,12 +995,12 @@ retry_snap: | |||
995 | inode, ceph_vinop(inode), pos, count, ceph_cap_string(got)); | 995 | inode, ceph_vinop(inode), pos, count, ceph_cap_string(got)); |
996 | 996 | ||
997 | if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 || | 997 | if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 || |
998 | (file->f_flags & O_DIRECT) || (fi->flags & CEPH_F_SYNC)) { | 998 | (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { |
999 | struct iov_iter data; | 999 | struct iov_iter data; |
1000 | mutex_unlock(&inode->i_mutex); | 1000 | mutex_unlock(&inode->i_mutex); |
1001 | /* we might need to revert back to that point */ | 1001 | /* we might need to revert back to that point */ |
1002 | data = *from; | 1002 | data = *from; |
1003 | if (file->f_flags & O_DIRECT) | 1003 | if (iocb->ki_flags & IOCB_DIRECT) |
1004 | written = ceph_sync_direct_write(iocb, &data, pos); | 1004 | written = ceph_sync_direct_write(iocb, &data, pos); |
1005 | else | 1005 | else |
1006 | written = ceph_sync_write(iocb, &data, pos); | 1006 | written = ceph_sync_write(iocb, &data, pos); |