If no data has been processed during recvmsg, return the error code.
This covers all errors received during non-AIO operations.
If any error occurs during a synchronous operation in addition to
-EIOCBQUEUED or -EBADMSG (like -ENOMEM), it should be relayed to the
caller.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
                 * only handle one AIO request. If the caller wants to have
                 * multiple AIO requests in parallel, he must make multiple
                 * separate AIO calls.
+                *
+                * Also return the error if no data has been processed so far.
                 */
                if (err <= 0) {
-                       if (err == -EIOCBQUEUED || err == -EBADMSG)
+                       if (err == -EIOCBQUEUED || err == -EBADMSG || !ret)
                                ret = err;
                        goto out;
                }
 
                 * only handle one AIO request. If the caller wants to have
                 * multiple AIO requests in parallel, he must make multiple
                 * separate AIO calls.
+                *
+                * Also return the error if no data has been processed so far.
                 */
                if (err <= 0) {
-                       if (err == -EIOCBQUEUED)
+                       if (err == -EIOCBQUEUED || !ret)
                                ret = err;
                        goto out;
                }