Merge tag 'gfs2-4.15.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2...
[linux-2.6-microblaze.git] / fs / aio.c
index 8f01275..e6de771 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -373,6 +373,14 @@ static int aio_migratepage(struct address_space *mapping, struct page *new,
        pgoff_t idx;
        int rc;
 
+       /*
+        * We cannot support the _NO_COPY case here, because copy needs to
+        * happen under the ctx->completion_lock. That does not work with the
+        * migration workflow of MIGRATE_SYNC_NO_COPY.
+        */
+       if (mode == MIGRATE_SYNC_NO_COPY)
+               return -EINVAL;
+
        rc = 0;
 
        /* mapping->private_lock here protects against the kioctx teardown.  */
@@ -568,7 +576,7 @@ static int kiocb_cancel(struct aio_kiocb *kiocb)
         * actually has a cancel function, hence the cmpxchg()
         */
 
-       cancel = ACCESS_ONCE(kiocb->ki_cancel);
+       cancel = READ_ONCE(kiocb->ki_cancel);
        do {
                if (!cancel || cancel == KIOCB_CANCELLED)
                        return -EINVAL;
@@ -1598,12 +1606,6 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                goto out_put_req;
        }
 
-       if ((req->common.ki_flags & IOCB_NOWAIT) &&
-                       !(req->common.ki_flags & IOCB_DIRECT)) {
-               ret = -EOPNOTSUPP;
-               goto out_put_req;
-       }
-
        ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
        if (unlikely(ret)) {
                pr_debug("EFAULT: aio_key\n");