usb: xhci: Add support for URB_ZERO_PACKET to bulk/sg transfers
[firefly-linux-kernel-4.4.55.git] / drivers / target / target_core_file.c
index 3b2879316b879cebfc8e5fbb44c6a8679555a711..8baaa0a26d70c7cffb24a6b46d325686e2f89c78 100644 (file)
@@ -554,7 +554,16 @@ fd_execute_rw(struct se_cmd *cmd)
        enum dma_data_direction data_direction = cmd->data_direction;
        struct se_device *dev = cmd->se_dev;
        int ret = 0;
-
+       /*
+        * We are currently limited by the number of iovecs (2048) per
+        * single vfs_[writev,readv] call.
+        */
+       if (cmd->data_length > FD_MAX_BYTES) {
+               pr_err("FILEIO: Not able to process I/O of %u bytes due to"
+                      "FD_MAX_BYTES: %u iovec count limitiation\n",
+                       cmd->data_length, FD_MAX_BYTES);
+               return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+       }
        /*
         * Call vectorized fileio functions to map struct scatterlist
         * physical memory addresses to struct iovec virtual memory.