aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2017-06-20 08:05:42 -0400
committerJens Axboe <axboe@kernel.dk>2017-06-20 09:12:03 -0400
commit9830f4be159b29399d107bffb99e0132bc5aedd4 (patch)
treeda2f9199e0921f78dd4500916215c19ae8914134 /fs/aio.c
parent7fc9e4722435cd8459182c4975f48934f2bb1274 (diff)
fs: Use RWF_* flags for AIO operations
aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in effect is dio_await_one(). All the rest of the locations, aio code return -EIOCBQUEUED before the checks for RWF_HIPRI. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/aio.c b/fs/aio.c
index f52d925ee259..020fa0045e3c 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1541,7 +1541,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1541 ssize_t ret; 1541 ssize_t ret;
1542 1542
1543 /* enforce forwards compatibility on users */ 1543 /* enforce forwards compatibility on users */
1544 if (unlikely(iocb->aio_reserved1 || iocb->aio_reserved2)) { 1544 if (unlikely(iocb->aio_reserved2)) {
1545 pr_debug("EINVAL: reserve field set\n"); 1545 pr_debug("EINVAL: reserve field set\n");
1546 return -EINVAL; 1546 return -EINVAL;
1547 } 1547 }
@@ -1586,6 +1586,12 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1586 req->common.ki_flags |= IOCB_EVENTFD; 1586 req->common.ki_flags |= IOCB_EVENTFD;
1587 } 1587 }
1588 1588
1589 ret = kiocb_set_rw_flags(&req->common, iocb->aio_rw_flags);
1590 if (unlikely(ret)) {
1591 pr_debug("EINVAL: aio_rw_flags\n");
1592 goto out_put_req;
1593 }
1594
1589 ret = put_user(KIOCB_KEY, &user_iocb->aio_key); 1595 ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
1590 if (unlikely(ret)) { 1596 if (unlikely(ret)) {
1591 pr_debug("EFAULT: aio_key\n"); 1597 pr_debug("EFAULT: aio_key\n");