All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-mirror: do not degrade the mirror on discard error
@ 2015-02-12 15:09 Mikulas Patocka
  2015-02-12 15:43 ` Mikulas Patocka
  2015-02-15  2:39 ` James Bottomley
  0 siblings, 2 replies; 12+ messages in thread
From: Mikulas Patocka @ 2015-02-12 15:09 UTC (permalink / raw)
  To: Heinz Mauelshagen, Zdenek Kabelac, Alasdair G. Kergon,
	Mike Snitzer
  Cc: dm-devel

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>

Index: linux-2.6/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-raid1.c
+++ linux-2.6/drivers/md/dm-raid1.c
@@ -604,6 +604,15 @@ static void write_callback(unsigned long
 		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);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-02-18 18:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 15:09 [PATCH] dm-mirror: do not degrade the mirror on discard error Mikulas Patocka
2015-02-12 15:43 ` Mikulas Patocka
2015-02-15  2:39 ` James Bottomley
2015-02-15  3:36   ` Mike Snitzer
2015-02-16 12:44   ` [PATCH] " Mikulas Patocka
2015-02-16 14:27     ` James Bottomley
2015-02-17 19:59       ` Mikulas Patocka
2015-02-18 15:16         ` James Bottomley
2015-02-18 16:29           ` Mikulas Patocka
2015-02-18 17:10             ` Mike Snitzer
2015-02-18 17:54               ` James Bottomley
2015-02-18 18:21                 ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.