iov_iter: fix iov_iter_type [Linux 5.1]

iov_iter: fix iov_iter_type [Linux 5.1]

This Linux kernel change "iov_iter: fix iov_iter_type" is included in the Linux 5.1 release. This change is authored by Ming Lei <ming.lei [at]> on Fri Apr 26 18:45:21 2019 +0800. The commit for this change in Linux stable tree is f5eb4d3 (patch).

iov_iter: fix iov_iter_type

Commit 875f1d0769cd ("iov_iter: add ITER_BVEC_FLAG_NO_REF flag")
introduces one extra flag of ITER_BVEC_FLAG_NO_REF, and this flag
is stored into iter->type.

However, iov_iter_type() doesn't consider the new added flag, fix
it by masking this flag in iov_iter_type().

Fixes: 875f1d0769cd ("iov_iter: add ITER_BVEC_FLAG_NO_REF flag")
Reviewed-by: Christoph Hellwig <>
Signed-off-by: Ming Lei <>
Signed-off-by: Jens Axboe <>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 include/linux/uio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index f184af1..2d0131a 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -60,7 +60,7 @@ struct iov_iter {

 static inline enum iter_type iov_iter_type(const struct iov_iter *i)
-   return i->type & ~(READ | WRITE);
+   return i->type & ~(READ | WRITE | ITER_BVEC_FLAG_NO_REF);

 static inline bool iter_is_iovec(const struct iov_iter *i)

Leave a Reply

Your email address will not be published. Required fields are marked *