Skip to contentSkip to conversation

dm-ebs: Fix incorrect checking for REQ_OP_FLUSH.

PATCH In review John Dorminy 2 participants 2 messages Jul 31, 2020 – Aug 4, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-ebs: Fix incorrect checking for REQ_OP_FLUSH.

REQ_OP_FLUSH was being treated as a flag, but the operation part of bio->bi_opf must be treated as a whole. Change to accessing the operation part via bio_op(bio) and checking for equality.

---
 drivers/md/dm-ebs-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ebs-target.c +1 -1
index 44451276f128..cb85610527c2 100644
@@ -363,7 +363,7 @@ static int ebs_map(struct dm_target *ti, struct bio *bio)
 	bio_set_dev(bio, ec->dev->bdev);
 	bio->bi_iter.bi_sector = ec->start + dm_target_offset(ti, bio->bi_iter.bi_sector);
 
-	if (unlikely(bio->bi_opf & REQ_OP_FLUSH))
+	if (unlikely(bio_op(bio) == REQ_OP_FLUSH))
 		return DM_MAPIO_REMAPPED;
 	/*
 	 * Only queue for bufio processing in case of partial or overlapping buffers
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · John Dorminy

REQ_OP_FLUSH was being treated as a flag, but the operation part of bio->bi_opf must be treated as a whole. Change to accessing the operation part via bio_op(bio) and checking for equality.

---
  drivers/md/dm-ebs-target.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ebs-target.c +1 -1
index 44451276f128..cb85610527c2 100644
@@ -363,7 +363,7 @@ static int ebs_map(struct dm_target *ti, struct bio *bio)
  	bio_set_dev(bio, ec->dev->bdev);
  	bio->bi_iter.bi_sector = ec->start + dm_target_offset(ti, bio->bi_iter.bi_sector);
 
-	if (unlikely(bio->bi_opf & REQ_OP_FLUSH))
+	if (unlikely(bio_op(bio) == REQ_OP_FLUSH))
  		return DM_MAPIO_REMAPPED;
  	/*
  	 * Only queue for bufio processing in case of partial