block: Ensure we only enable integrity metadata for reads and writes
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Apr 2014 02:59:31 +0000 (22:59 -0400)
committerJens Axboe <axboe@fb.com>
Wed, 9 Apr 2014 14:00:06 +0000 (08:00 -0600)
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>
fs/bio-integrity.c

index b355b98dbf1b4dcf8d0ce70683af0d97db5c3e59..1c2ce0c8771133194ecb9d91517a7dd67c571765 100644 (file)
@@ -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;