diff --git a/include/linux/uio.h b/include/linux/uio.h index a41e252396c0a4d58910858db78a7c6e5e800973..1c5e453f7ea997364a4d26852a2b532ec3b8acd5 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) return i->count; } +static inline bool iter_is_iovec(struct iov_iter *i) +{ + return !(i->type & (ITER_BVEC | ITER_KVEC)); +} + /* * Cap the iov_iter by given limit; note that the second argument is * *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 e8905bc3cbd7c546dd9c1e586b61abac9d38cc8f..bd8543c6508fd8dfd9e6fce5f4884d1d6ab0b5bb 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2464,7 +2464,7 @@ ssize_t generic_perform_write(struct file *file, /* * Copies from kernel address space cannot fail (NFSD is a big user). */ - if (segment_eq(get_fs(), KERNEL_DS)) + if (!iter_is_iovec(i)) flags |= AOP_FLAG_UNINTERRUPTIBLE; do { diff --git a/mm/shmem.c b/mm/shmem.c index 185836ba53ef6e23a63b6a0de7c22ebae19eac0b..73ba1df7c8ba1bcf17f0ef2ee0930c13db56730e 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) * holes of a sparse file, we actually need to allocate those pages, * and even mark them dirty, so it cannot exceed the max_blocks limit. */ - if (segment_eq(get_fs(), KERNEL_DS)) + if (!iter_is_iovec(to)) sgp = SGP_DIRTY; index = *ppos >> PAGE_CACHE_SHIFT;