Created attachment 407012 [details] Fixed parted did not handle the return value of dm_task_run() correctly Description of problem: When programed with parted and found below command always return 0 even failed: # parted /dev/mapper/mpath1 -s -- mklabel msdos mkpart primary 2048s -1s device-mapper: remove ioctl failed: Device or resource busy device-mapper: remove ioctl failed: Device or resource busy device-mapper: create ioctl failed: Device or resource busy # echo $? 0 How reproducible: Always as above command. Steps to Reproduce: 1. Above command. Actual results: Expected results: Return no-zero on failed, otherwise return zero. Additional info: Checked source code of parted found in libparted/arch/linux.c, when call dm_ related functions, it always think return value <0 if failed, in fact, checked source code of dm_..() functions and found it always return 1 on success, error will return 0, it's the root cause. Attach the patch, please review and include it.
Hi, Thanks for the bug report and the patch. I've contacted the lvm devs to clarify the return code meaning of dm_task_run. I'll get back to you when I have an answer from then. Regards, Hans
*** Bug 582904 has been marked as a duplicate of this bug. ***
I've a patch ready for fixing this.
Moving to 5.7 proposed list since parted did not make the approved component list for 5.6.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release.
Moving to 5.8 since we have a reasonably low impact patch for this.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Prior to this update, the parted utility did not handle the return value of the dm_task_run() call correctly on device-mapper devices. As a consequence, parted returned a 0 exit status even if an error occurred. The utility has been modified and now correctly returns 1 if an error occurs.
Patch is present and applied in parted-1.8.1-29.el5.src.rpm
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0192.html