mm: Don't pin ZERO_PAGE in pin_user_pages()
[linux-block.git] / include / linux / bio.h
index b3e7529ff55eb3966c474ee8bc1e50bfea0ded69..8588bcfbc6eff518fa2227a8dbb188be814f081e 100644 (file)
@@ -229,7 +229,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count)
 
 static inline bool bio_flagged(struct bio *bio, unsigned int bit)
 {
-       return (bio->bi_flags & (1U << bit)) != 0;
+       return bio->bi_flags & (1U << bit);
 }
 
 static inline void bio_set_flag(struct bio *bio, unsigned int bit)
@@ -488,7 +488,8 @@ void zero_fill_bio(struct bio *bio);
 
 static inline void bio_release_pages(struct bio *bio, bool mark_dirty)
 {
-       if (!bio_flagged(bio, BIO_NO_PAGE_REF))
+       if (bio_flagged(bio, BIO_PAGE_REFFED) ||
+           bio_flagged(bio, BIO_PAGE_PINNED))
                __bio_release_pages(bio, mark_dirty);
 }