Merge tag 'mtd/fixes-for-4.14-rc3' of git://git.infradead.org/linux-mtd
[sfrench/cifs-2.6.git] / fs / aio.c
index 8f01275262997740faefa54301189dfab163835f..5a2487217072d18b1b5a25b6961e6cdd938375fc 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.  */
@@ -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");