Skip to content

Commit

Permalink
dm mirror: do not degrade the mirror on discard error
Browse files Browse the repository at this point in the history
It may be possible that a device claims discard support but it rejects
discards with -EOPNOTSUPP.  It happens when using loopback on ext2/ext3
filesystem driven by the ext4 driver.  It may also happen if the
underlying devices are moved from one disk on another.

If discard error happens, we reject the bio with -EOPNOTSUPP, but we do
not degrade the array.

This patch fixes failed test shell/lvconvert-repair-transient.sh in the
lvm2 testsuite if the testsuite is extracted on an ext2 or ext3
filesystem and it is being driven by the ext4 driver.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Feb 14, 2015
1 parent 145b900 commit f2ed51a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context)
return;
}

/*
* If the bio is discard, return an error, but do not
* degrade the array.
*/
if (bio->bi_rw & REQ_DISCARD) {
bio_endio(bio, -EOPNOTSUPP);
return;
}

for (i = 0; i < ms->nr_mirrors; i++)
if (test_bit(i, &error))
fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR);
Expand Down

0 comments on commit f2ed51a

Please sign in to comment.