All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] [RFC] switch DM tables to readonly automatically
@ 2008-04-30  8:19 Christophe Varoqui
  2008-04-30  8:57 ` Hannes Reinecke
  0 siblings, 1 reply; 7+ messages in thread
From: Christophe Varoqui @ 2008-04-30  8:19 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: device-mapper development


> Hi all,
> 
> this patch switches the device-mapper table to read-only status automatically if one underlying device returns -EROFS.
> 
> Rationale:
> Whenever a SCSI device is switched to read-only a table reload from multipath-tools fails, without any indication about the reason. And it's actually quite tricky to detect the read-only status from userland. And quite pointless, too, as the kernel already knows about it.
> 
> And we now can create tables for CD-ROMs, too, without having to use the '-r' flag to dmsetup ...
> 
> Christophe, this might also fix your problem.
> 
It seems it will solve the map creation error on read-only LU, but what about these LU becoming writable ? ...
as is the case with the Symmetrix R2 upon spliting the synchronisation link.
Will the devmap become writable too automagically or is the multipathd daemon expected to take action the promote the map RW ?

Thanks for caring anyway.

> As usual, comments etc are welcome.
> 
> Cheers,
> 
> Hannes
> --
> Dr. Hannes Reinecke                   zSeries & Storage
> hare suse de                          +49 911 74053 688
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: Markus Rex, HRB 16746 (AG Nürnberg)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] [RFC] switch DM tables to readonly automatically
@ 2008-04-25 14:32 Hannes Reinecke
  2008-04-30  5:43 ` Balasubramanian, Vijayakumar (STSD)
  2008-05-01 11:24 ` Alasdair G Kergon
  0 siblings, 2 replies; 7+ messages in thread
From: Hannes Reinecke @ 2008-04-25 14:32 UTC (permalink / raw)
  To: device-mapper development

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

Hi all,

this patch switches the device-mapper table to read-only
status automatically if one underlying device returns -EROFS.

Rationale:
Whenever a SCSI device is switched to read-only a table
reload from multipath-tools fails, without any indication
about the reason. And it's actually quite tricky to detect
the read-only status from userland. And quite pointless, too,
as the kernel already knows about it.

And we now can create tables for CD-ROMs, too, without
having to use the '-r' flag to dmsetup ...

Christophe, this might also fix your problem.

As usual, comments etc are welcome.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

[-- Attachment #2: dm-table-switch-to-readonly --]
[-- Type: text/plain, Size: 609 bytes --]

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index e75b143..f615e85 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -501,11 +501,19 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
 		dd->mode = mode;
 		dd->bdev = NULL;
 
-		if ((r = open_dev(dd, dev, t->md))) {
+		r = open_dev(dd, dev, t->md);
+		if (r == -EROFS) {
+			dd->mode &= ~FMODE_WRITE;
+			r = open_dev(dd, dev, t->md);
+		}
+		if (r) {
 			kfree(dd);
 			return r;
 		}
 
+		if (dd->mode != mode)
+			t->mode = dd->mode;
+
 		format_dev_t(dd->name, dev);
 
 		atomic_set(&dd->count, 0);

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2008-05-02  6:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30  8:19 [PATCH] [RFC] switch DM tables to readonly automatically Christophe Varoqui
2008-04-30  8:57 ` Hannes Reinecke
2008-04-30  9:34   ` Christophe Varoqui
  -- strict thread matches above, loose matches on Subject: below --
2008-04-25 14:32 Hannes Reinecke
2008-04-30  5:43 ` Balasubramanian, Vijayakumar (STSD)
2008-05-01 11:24 ` Alasdair G Kergon
2008-05-02  6:24   ` Hannes Reinecke

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.