]> git.openpandora.org Git - pandora-kernel.git/commitdiff
mirror O_APPEND and O_DIRECT into iocb->ki_flags
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Apr 2015 17:52:01 +0000 (13:52 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Apr 2015 02:30:22 +0000 (22:30 -0400)
... avoiding write_iter/fcntl races.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/aio.c
fs/btrfs/file.c
fs/ceph/file.c
fs/ext4/file.c
fs/fuse/file.c
fs/gfs2/file.c
fs/nfs/file.c
fs/ocfs2/file.c
fs/xfs/xfs_file.c
include/linux/fs.h
mm/filemap.c

index 5785c4b58fea5ffdeae17d43b6b00df2572dc638..e976185c8e5b3a8dbad29af7ff17fca08e50088f 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1502,7 +1502,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
        }
        req->common.ki_pos = iocb->aio_offset;
        req->common.ki_complete = aio_complete;
-       req->common.ki_flags = 0;
+       req->common.ki_flags = iocb_flags(req->common.ki_filp);
 
        if (iocb->aio_flags & IOCB_FLAG_RESFD) {
                /*
index c64d11c41eeb5524d281bc93dcae259412e59159..faa7d390841b9a245a95ffb4944d515c3c486cbf 100644 (file)
@@ -1794,7 +1794,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
        if (sync)
                atomic_inc(&BTRFS_I(inode)->sync_writers);
 
-       if (file->f_flags & O_DIRECT) {
+       if (iocb->ki_flags & IOCB_DIRECT) {
                num_written = __btrfs_direct_write(iocb, from, pos);
        } else {
                num_written = __btrfs_buffered_write(file, from, pos);
index 3f0b9339d823447621181eafb87e980f6d210b78..b9b8eb225f66ead124f4a1484cfc5b76dbb8d2fb 100644 (file)
@@ -457,7 +457,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
        if (ret < 0)
                return ret;
 
-       if (file->f_flags & O_DIRECT) {
+       if (iocb->ki_flags & IOCB_DIRECT) {
                while (iov_iter_count(i)) {
                        size_t start;
                        ssize_t n;
@@ -828,7 +828,7 @@ again:
                return ret;
 
        if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 ||
-           (iocb->ki_filp->f_flags & O_DIRECT) ||
+           (iocb->ki_flags & IOCB_DIRECT) ||
            (fi->flags & CEPH_F_SYNC)) {
 
                dout("aio_sync_read %p %llx.%llx %llu~%u got cap refs on %s\n",
@@ -995,12 +995,12 @@ retry_snap:
             inode, ceph_vinop(inode), pos, count, ceph_cap_string(got));
 
        if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 ||
-           (file->f_flags & O_DIRECT) || (fi->flags & CEPH_F_SYNC)) {
+           (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) {
                struct iov_iter data;
                mutex_unlock(&inode->i_mutex);
                /* we might need to revert back to that point */
                data = *from;
-               if (file->f_flags & O_DIRECT)
+               if (iocb->ki_flags & IOCB_DIRECT)
                        written = ceph_sync_direct_write(iocb, &data, pos);
                else
                        written = ceph_sync_write(iocb, &data, pos);
diff --cc fs/ext4/file.c
Simple merge
diff --cc fs/fuse/file.c
Simple merge
diff --cc fs/gfs2/file.c
Simple merge
diff --cc fs/nfs/file.c
Simple merge
diff --cc fs/ocfs2/file.c
Simple merge
Simple merge
Simple merge
diff --cc mm/filemap.c
Simple merge