diff options
-rw-r--r-- | include/linux/uio.h | 5 | ||||
-rw-r--r-- | mm/filemap.c | 2 | ||||
-rw-r--r-- | mm/shmem.c | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index a41e252396c0..1c5e453f7ea9 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -101,6 +101,11 @@ static inline size_t iov_iter_count(struct iov_iter *i) | |||
101 | return i->count; | 101 | return i->count; |
102 | } | 102 | } |
103 | 103 | ||
104 | static inline bool iter_is_iovec(struct iov_iter *i) | ||
105 | { | ||
106 | return !(i->type & (ITER_BVEC | ITER_KVEC)); | ||
107 | } | ||
108 | |||
104 | /* | 109 | /* |
105 | * Cap the iov_iter by given limit; note that the second argument is | 110 | * Cap the iov_iter by given limit; note that the second argument is |
106 | * *not* the new size - it's upper limit for such. Passing it a value | 111 | * *not* the new size - it's upper limit for such. Passing it a value |
diff --git a/mm/filemap.c b/mm/filemap.c index e8905bc3cbd7..bd8543c6508f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2464,7 +2464,7 @@ ssize_t generic_perform_write(struct file *file, | |||
2464 | /* | 2464 | /* |
2465 | * Copies from kernel address space cannot fail (NFSD is a big user). | 2465 | * Copies from kernel address space cannot fail (NFSD is a big user). |
2466 | */ | 2466 | */ |
2467 | if (segment_eq(get_fs(), KERNEL_DS)) | 2467 | if (!iter_is_iovec(i)) |
2468 | flags |= AOP_FLAG_UNINTERRUPTIBLE; | 2468 | flags |= AOP_FLAG_UNINTERRUPTIBLE; |
2469 | 2469 | ||
2470 | do { | 2470 | do { |
diff --git a/mm/shmem.c b/mm/shmem.c index 185836ba53ef..73ba1df7c8ba 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1536,7 +1536,7 @@ static ssize_t shmem_file_read_iter(struct kiocb *iocb, struct iov_iter *to) | |||
1536 | * holes of a sparse file, we actually need to allocate those pages, | 1536 | * holes of a sparse file, we actually need to allocate those pages, |
1537 | * and even mark them dirty, so it cannot exceed the max_blocks limit. | 1537 | * and even mark them dirty, so it cannot exceed the max_blocks limit. |
1538 | */ | 1538 | */ |
1539 | if (segment_eq(get_fs(), KERNEL_DS)) | 1539 | if (!iter_is_iovec(to)) |
1540 | sgp = SGP_DIRTY; | 1540 | sgp = SGP_DIRTY; |
1541 | 1541 | ||
1542 | index = *ppos >> PAGE_CACHE_SHIFT; | 1542 | index = *ppos >> PAGE_CACHE_SHIFT; |