diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2014-02-06 15:14:13 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-02-07 15:49:48 -0500 |
commit | 087787959ce851d7bbb19f10f6e9241b7f85a3ca (patch) | |
tree | d4cd09112a3620906034e88a342b05d1ea49232a /fs | |
parent | 14ec77f352cb00ab8425ec2af03bd7e529eefe24 (diff) |
block: Fix nr_vecs for inline integrity vectors
Commit 9f060e2231ca changed the way we handle allocations for the
integrity vectors. When the vectors are inline there is no associated
slab and consequently bvec_nr_vecs() returns 0. Ensure that we check
against BIP_INLINE_VECS in that case.
Reported-by: David Milburn <dmilburn@redhat.com>
Tested-by: David Milburn <dmilburn@redhat.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio-integrity.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index 0bad24ddc2e7..bcb4a4d533a2 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -114,6 +114,14 @@ void bio_integrity_free(struct bio *bio) | |||
114 | } | 114 | } |
115 | EXPORT_SYMBOL(bio_integrity_free); | 115 | EXPORT_SYMBOL(bio_integrity_free); |
116 | 116 | ||
117 | static inline unsigned int bip_integrity_vecs(struct bio_integrity_payload *bip) | ||
118 | { | ||
119 | if (bip->bip_slab == BIO_POOL_NONE) | ||
120 | return BIP_INLINE_VECS; | ||
121 | |||
122 | return bvec_nr_vecs(bip->bip_slab); | ||
123 | } | ||
124 | |||
117 | /** | 125 | /** |
118 | * bio_integrity_add_page - Attach integrity metadata | 126 | * bio_integrity_add_page - Attach integrity metadata |
119 | * @bio: bio to update | 127 | * @bio: bio to update |
@@ -129,7 +137,7 @@ int bio_integrity_add_page(struct bio *bio, struct page *page, | |||
129 | struct bio_integrity_payload *bip = bio->bi_integrity; | 137 | struct bio_integrity_payload *bip = bio->bi_integrity; |
130 | struct bio_vec *iv; | 138 | struct bio_vec *iv; |
131 | 139 | ||
132 | if (bip->bip_vcnt >= bvec_nr_vecs(bip->bip_slab)) { | 140 | if (bip->bip_vcnt >= bip_integrity_vecs(bip)) { |
133 | printk(KERN_ERR "%s: bip_vec full\n", __func__); | 141 | printk(KERN_ERR "%s: bip_vec full\n", __func__); |
134 | return 0; | 142 | return 0; |
135 | } | 143 | } |