diff options
| -rw-r--r-- | fs/bio-integrity.c | 5 | ||||
| -rw-r--r-- | include/linux/bio.h | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index ca7b02dbf09d..8fb42916d8a2 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
| @@ -97,9 +97,7 @@ void bio_integrity_free(struct bio *bio) | |||
| 97 | struct bio_integrity_payload *bip = bio->bi_integrity; | 97 | struct bio_integrity_payload *bip = bio->bi_integrity; |
| 98 | struct bio_set *bs = bio->bi_pool; | 98 | struct bio_set *bs = bio->bi_pool; |
| 99 | 99 | ||
| 100 | /* A cloned bio doesn't own the integrity metadata */ | 100 | if (bip->bip_owns_buf) |
| 101 | if (!bio_flagged(bio, BIO_CLONED) && !bio_flagged(bio, BIO_FS_INTEGRITY) | ||
| 102 | && bip->bip_buf != NULL) | ||
| 103 | kfree(bip->bip_buf); | 101 | kfree(bip->bip_buf); |
| 104 | 102 | ||
| 105 | if (bs) { | 103 | if (bs) { |
| @@ -386,6 +384,7 @@ int bio_integrity_prep(struct bio *bio) | |||
| 386 | return -EIO; | 384 | return -EIO; |
| 387 | } | 385 | } |
| 388 | 386 | ||
| 387 | bip->bip_owns_buf = 1; | ||
| 389 | bip->bip_buf = buf; | 388 | bip->bip_buf = buf; |
| 390 | bip->bip_size = len; | 389 | bip->bip_size = len; |
| 391 | bip->bip_sector = bio->bi_sector; | 390 | bip->bip_sector = bio->bi_sector; |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 794bcd0c5039..ef24466d8f82 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -187,6 +187,7 @@ struct bio_integrity_payload { | |||
| 187 | unsigned short bip_slab; /* slab the bip came from */ | 187 | unsigned short bip_slab; /* slab the bip came from */ |
| 188 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ | 188 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ |
| 189 | unsigned short bip_idx; /* current bip_vec index */ | 189 | unsigned short bip_idx; /* current bip_vec index */ |
| 190 | unsigned bip_owns_buf:1; /* should free bip_buf */ | ||
| 190 | 191 | ||
| 191 | struct work_struct bip_work; /* I/O completion */ | 192 | struct work_struct bip_work; /* I/O completion */ |
| 192 | 193 | ||
