Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 185444

Summary: kernel dm: missing bdput
Product: Red Hat Enterprise Linux 4 Reporter: Alasdair Kergon <agk>
Component: kernelAssignee: Alasdair Kergon <agk>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: jbaron, mbroz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2006-0575 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-10 22:40:43 UTC Type: ---
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: 181409    
Attachments:
Description Flags
Regression test for this bug none

Description Alasdair Kergon 2006-03-14 20:43:45 UTC
From: Jun'ichi Nomura <j-nomura.nec.com>
 
If we hold a bdev inode for a suspended device
when freeing it, we must call bdput first.
 
Signed-off-by: Jun'ichi Nomura <j-nomura.nec.com>
Signed-Off-By: Alasdair G Kergon <agk>
 
Index: linux-2.6.16-rc1/drivers/md/dm.c
===================================================================
--- linux-2.6.16-rc1.orig/drivers/md/dm.c       2006-03-01 21:40:30.000000000 +0000
+++ linux-2.6.16-rc1/drivers/md/dm.c    2006-03-01 21:42:55.000000000 +0000
@@ -849,6 +849,10 @@ static struct mapped_device *alloc_dev(u
  
 static void free_dev(struct mapped_device *md)
 {
+       if (md->suspended_bdev) {
+               thaw_bdev(md->suspended_bdev, NULL);
+               bdput(md->suspended_bdev);
+       }
        free_minor(md->disk->first_minor);
        mempool_destroy(md->tio_pool);
        mempool_destroy(md->io_pool);

Comment 3 Jun'ichi NOMURA 2006-03-20 15:36:22 UTC
Created attachment 126349 [details]
Regression test for this bug

Regression test for this bug.

If the bug is fixed, you see 'PASS'.
Otherwise, the test never finishes and dmsetup will hang
with backtrace like below:

crash> bt 32540
PID: 32540  TASK: e00000017ca98000  CPU: 0   COMMAND: "dmsetup"
 #0 [BSP:e00000017ca992a8] context_switch at a000000100068500
 #1 [BSP:e00000017ca99188] schedule at a000000100586fc0
 #2 [BSP:e00000017ca99128] __down at a0000001005867f0
 #3 [BSP:e00000017ca990e8] freeze_bdev at a000000100123960
 #4 [BSP:e00000017ca99098] dm_suspend at a0000002003e0e40
 #5 [BSP:e00000017ca99048] dev_suspend at a0000002003ea760
 #6 [BSP:e00000017ca98fe0] ctl_ioctl at a0000002003eda60
 #7 [BSP:e00000017ca98f50] sys_ioctl at a00000010014f280
 #8 [BSP:e00000017ca98f50] ia64_ret_from_syscall at a00000010000f3e0

Comment 4 Jason Baron 2006-03-28 17:43:39 UTC
committed in stream u4 build 34.9. A test kernel with this patch is available
from http://people.redhat.com/~jbaron/rhel4/

Comment 5 Jeff Burke 2006-03-30 16:06:48 UTC
This testcase had been add to RHTS /kernel/filesystems/185444

Comment 9 Red Hat Bugzilla 2006-08-10 22:40:43 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2006-0575.html