bio: return EINTR if copying to user space got interrupted
[pandora-kernel.git] / fs / bio.c
index b84d851..55b5188 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -793,15 +793,19 @@ int bio_uncopy_user(struct bio *bio)
        if (!bio_flagged(bio, BIO_NULL_MAPPED)) {
                /*
                 * if we're in a workqueue, the request is orphaned, so
-                * don't copy into a random user address space, just free.
+                * don't copy into a random user address space, just free
+                * and return -EINTR so user space doesn't expect any data.
                 */
                if (current->mm)
                        ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
                                             bmd->nr_sgvecs, bio_data_dir(bio) == READ,
                                             0, bmd->is_our_pages);
-               else if (bmd->is_our_pages)
-                       bio_for_each_segment_all(bvec, bio, i)
-                               __free_page(bvec->bv_page);
+               else {
+                       ret = -EINTR;
+                       if (bmd->is_our_pages)
+                               bio_for_each_segment_all(bvec, bio, i)
+                                       __free_page(bvec->bv_page);
+               }
        }
        bio_free_map_data(bmd);
        bio_put(bio);