Skip to contentSkip to conversation

master - mirror: Avoid reading from mirrors that have failed devices

PATCH Jonathan Brassow 1 participant 1 message Oct 24, 2012

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76
Commit:        9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76
Parent:        b873fc54baf12891158017cd732e01a7f19b3ac3
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Tue Oct 23 23:10:33 2012 -0500
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Tue Oct 23 23:10:33 2012 -0500

mirror: Avoid reading from mirrors that have failed devices

Addresses: rhbz855398 (Allow VGs to be built on cluster mirrors),
and other issues.

The LVM code attempts to avoid reading labels from devices that are suspended to try to avoid situations that may cause the commands to block indefinitely. When scanning devices, 'ignore_suspended_devices' can be set so the code (lib/activate/dev_manager.c:device_is_usable()) checks any DM devices it finds and avoids them if they are suspended.

The mirror target has an additional mechanism that can cause I/O to be blocked. If a device in a mirror fails, all I/O will be blocked by the kernel until a new table (a linear target or a mirror with replacement devices) is loaded. The mirror indicates that this condition has happened by marking a 'D' for the faulty device in its status output. This condition must also be checked by 'device_is_usable()' to avoid the possibility of blocking LVM commands indefinitely due to an attempt to read the blocked mirror for labels.

Until now, mirrors were avoided if the 'ignore_suspended_devices' condition was set. This check seemed to suggest, "if we are concerned about suspended devices, then let's ignore mirrors altogether just in case". This is insufficient and doesn't solve any problems. All devices that are suspended are already avoided if 'ignore_suspended_devices' is set; and if a mirror is blocking because of an error condition, it will block the LVM command regardless of the setting of that variable.

Rather than avoiding mirrors whenever 'ignore_suspended_devices' is set, this patch causes mirrors to be avoided whenever they are blocking due to an error. (As mentioned above, the case where a DM device is suspended is already covered.) This solves a number of issues that weren't handled before. For example, pvcreate (or any command that does a pv_read or vg_read, which eventually call device_is_usable()) will be protected from blocked mirrors regardless of how 'ignore_suspended_devices' is set. Additionally, a mirror that is neither suspended nor blocking is /allowed/ to be read regardless of how 'ignore_suspended_devices' is set. (The latter point being the source of the fix for rhbz855398.)

---
 WHATS_NEW                  |    1 +
 lib/activate/dev_manager.c |  160 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 155 insertions(+), 6 deletions(-)
WHATS_NEW +1 -0
index ffbf4ef..db776c0 100644
@@ -1,5 +1,6 @@
 Version 2.02.99 - 
 ===================================
+  Avoid reading from mirrors that have failed devices if they block I/O.
   Change lvs heading Copy% to Cpy%Sync and print RAID4/5/6 sync% there too.
   Fix clvmd support for option -d and properly use its argument.
   Support use of option --yes for lvchange --persistent.
lib/activate/dev_manager.c +154 -6

175 lines not on this page · raw message