Bug 1382382

Summary: Primary leg failure on mirror target results in read errors
Product: [Community] LVM and device-mapper Reporter: Zdenek Kabelac <zkabelac>
Component: device-mapperAssignee: Heinz Mauelshagen <heinzm>
Status: CLOSED UPSTREAM QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.02.165CC: agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac
Target Milestone: ---Keywords: Reopened
Target Release: ---Flags: rule-engine: lvm-technical-solution?
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1382516 1382517 (view as bug list) Environment:
Last Closed: 2018-09-18 20:06:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1382516, 1382517, 1383444    
Attachments:
Description Flags
lvm2 test suite showing how to hit the issue none

Description Zdenek Kabelac 2016-10-06 14:17:03 UTC
Description of problem:

With i.e. 2-leg mirror -  fail of 'primary' leg  has problem when
write to such mirror is not sector aligned.

i.e.

lvcreate -LX -m1 --type mirror -n mir vg  /dev/PV1 /dev/PV2
fail PV1
echo C >/dev/vg/mir

gives:

raid1: Mirror read failed from 253:5. Trying alternative device
raid1: Mirror read failed.

Mirror puts primary leg in  'R' state - and such state
is not repaired by dmeventd.

Next write transition mirror in 'D' states and repair operation
is started by dmeventd.

Version-Release number of selected component (if applicable):
kernel 4.8

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Jonathan Earl Brassow 2016-10-06 20:59:26 UTC
(In reply to Zdenek Kabelac from comment #0)
> Description of problem:
> 
> With i.e. 2-leg mirror -  fail of 'primary' leg  has problem when
> write to such mirror is not sector aligned.
> 

I think what is meant is not "sector aligned", but "full sector".

The real problem here has nothing to do with writes, but rather a read (which a partial write will trigger).

Issue a read from a mirror with a failed primary leg, and it will fail - even though the secondary leg should be available for a retry.  This error only occurs when it is the primary device that is failed.

Comment 2 Jonathan Earl Brassow 2017-06-15 05:18:01 UTC
closing this issue NOTABUG.

See https://bugzilla.redhat.com/show_bug.cgi?id=1436374#c12

Comment 3 Heinz Mauelshagen 2017-06-16 12:48:15 UTC
Reverting upstream commit 12a7cf5 (rhel7 commit 646f3cc) ASAP as of Jon's conclusion in bz1436374 reintreduces this bug. Simply reverting it aiming to fix bz1436374 isn't correct. An enhanced fix addressing both bugs is necessary!

Comment 4 Zdenek Kabelac 2017-06-16 19:52:00 UTC
Created attachment 1288455 [details]
lvm2 test suite showing how to hit the issue

Comment 6 Heinz Mauelshagen 2018-09-18 20:06:35 UTC
Tested ok on kernel 4.17.6-100.fc27.x86_64 and 4.19-rc2 with
LVM version:     2.02.175(2) (2017-10-06)
  Library version: 1.02.147-git (2018-05-24)
  Driver version:  4.39.0
thus closing upstream.

# lvcreate -L128 --ty mirror -nm nvm

# lvs -aoname,size,attr,segtype,datastripes,copypercent,devices nvm
  LV           LSize   Attr       Type   #DStr Cpy%Sync Devices                    
  m            128.00m mwi-a-m--- mirror     2 100.00   m_mimage_0(0),m_mimage_1(0)
  [m_mimage_0] 128.00m iwi-aom--- linear     1          /dev/sdab(0)               
  [m_mimage_1] 128.00m iwi-aom--- linear     1          /dev/sdac(0)               
  [m_mlog]       4.00m lwi-aom--- linear     1          /dev/sdaa(0)

Reload nvm-m_mimage_0 with first sector error mapped

# echo -e "0 1 error\n`dmsetup  table nvm-m_mimage_0|sed 's/^0/1/;s/2048
/2047/'`"|dmsetup load nvm-m_mimage_0
# dmsetup resume nvm-m_mimage_0

# echo C > /dev/nvm/m

# lvs -aoname,size,attr,segtype,datastripes,copypercent,devices nvm
  Couldn't find device with uuid IVe2qP-KkqQ-DbkO-5tKn-UdEd-7HXj-KULiFV.
  LV           LSize   Attr       Type   #DStr Cpy%Sync Devices                    
  m            128.00m mwi-a-m--- mirror     2 100.00   m_mimage_0(0),m_mimage_1(0)
  [m_mimage_0] 128.00m iwi-aom--- linear     1          /dev/sdac(0)               
  [m_mimage_1] 128.00m iwi-aom--- linear     1          /dev/sdad(0)               
  [m_mlog]       4.00m lwi-aom--- linear     1          /dev/sdaa(0)