summaryrefslogtreecommitdiffstats
path: root/fs/bio-integrity.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-04-09 04:59:31 +0200
committerJens Axboe <axboe@fb.com>2014-04-09 16:00:06 +0200
commite69f18f06b97ed29645d020500222bfcec2b42b2 (patch)
tree1541e97cc116a058f42302aed325dc71fb7dfd91 /fs/bio-integrity.c
parentblock: Fix integrity verification (diff)
downloadlinux-e69f18f06b97ed29645d020500222bfcec2b42b2.tar.xz
linux-e69f18f06b97ed29645d020500222bfcec2b42b2.zip
block: Ensure we only enable integrity metadata for reads and writes
We'd occasionally attempt to generate protection information for flushes and other requests with a zero payload. Make sure we only attempt to enable integrity for reads and writes. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/bio-integrity.c')
-rw-r--r--fs/bio-integrity.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index b355b98dbf1b..1c2ce0c87711 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -182,6 +182,9 @@ static int bdev_integrity_enabled(struct block_device *bdev, int rw)
*/
int bio_integrity_enabled(struct bio *bio)
{
+ if (!bio_is_rw(bio))
+ return 0;
+
/* Already protected? */
if (bio_integrity(bio))
return 0;