Bug 1107315

Summary: RFE: Use DM_DEFERRED_REMOVE when removing pathless multipath devices
Product: Red Hat Enterprise Linux 6 Reporter: Ben Marzinski <bmarzins>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED DUPLICATE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: agk, bmarzins, dwysocha, heinzm, msnitzer, prajnoha, prockai, rbalakri, zkabelac
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1109431 (view as bug list) Environment:
Last Closed: 2015-10-14 18:54:16 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: 1109431, 1130168    
Bug Blocks:    
Attachments:
Description Flags
Log of unmounting a multipath device with no paths, set for deferred remove none

Description Ben Marzinski 2014-06-09 21:33:57 UTC
Description of problem:
When a multipath device losses all of its paths, multipathd tries to remove it. However, if it is in-use, this is impossible.  In this case, multipathd will never clean it up, even when the last user closes the device. Using the DM_DEFERRED_REMOVE flag, multipathd can schedule a removal for when the last user closes the device.  If a path comes back online before then, multipathd can cancel the deferred remove.

Comment 1 Ben Marzinski 2014-06-12 21:49:03 UTC
I tried to do this manually with the latest rhel-6.6 kernel, and the dmsetup patches, and it things got hung up pretty badly.  It's possible that there needs to be some kernel work to make this work correctly on multipath targets.  I'm pushing this out the 6.7 and I'll take a deeper look into it in a little bit.

Comment 3 Ben Marzinski 2014-06-13 15:34:10 UTC
Created attachment 908622 [details]
Log of unmounting a multipath device with no paths, set for deferred remove

This is a log from the serial console, when I finally unmount a multipath device set to deferred remove.  I'm did this over the serial console, because once this is finished.  all the ssh logins to the node hang.  Eventually the serial console login did to.

You should note that I ran this test with a multipath device that has no paths.  The reason for this is because I want to use deferred removes for exactly this case.  When the last path of a multipath device is removed, multipathd will try to delete it.  However, if it is open, the device can't be deleted.  Unfortunately, this means that the device just sits around, even once the last opener finally closes it.  I was planning on dealing with this cleanup in multipathd, but when Mikulas posted the deferred remove code, it seemed like an ideal way to do it.  I was just verifying that I could do this manually through dmsetup before adding the code to multipathd, when I hit this issue.

I'm going to verify that I don't see the same issue with a linear device or a multipath device with active paths, but I assume that it's specific to the way I want to use it for auto-removing devices with no paths and no users.

Comment 4 Ben Marzinski 2014-06-13 17:41:25 UTC
Trying this with a linear device worked fine.  Trying this with a multipath device that still had valid paths failed in the same way as a multipath device with no paths.

Comment 5 Alasdair Kergon 2014-06-21 00:32:12 UTC
kernel patch available on bug 1109431 fixes this problem

Comment 6 Ben Marzinski 2015-10-14 18:54:16 UTC

*** This bug has been marked as a duplicate of bug 1109431 ***