Bug 703479

Summary: in-use partition not detected (dmraid and scsi >=16): potential data loss
Product: [Fedora] Fedora Reporter: Jim Meyering <meyering>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: awilliam, bcl, collura, hdegoede, jlaska
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: AcceptedNTH
Fixed In Version: parted-2.3-8.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-14 00:07:50 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 657621    

Description Jim Meyering 2011-05-10 09:36:15 EDT
Description of problem: normally parted detects when a partition is in use and prohibits removing or resizing it.  However, when it's a partition on a dmraid disk, or when it's the 16th or larger partition on a scsi disk, parted would *not* detect that it is in use.  Thus, parted would not protect the user from a command that would potentially lead to data loss.

Version-Release number of selected component (if applicable): parted-2.3-7.fc15.x86_64


How reproducible: always

Steps to Reproduce:
1. create a partition table with 16 partitions
2. mount the 16th
3. use parted to remove the 16 partition table entry
  
Actual results: succeeds

Expected results: parted rejects the attempt to delete an in-use partition

Additional info: Fixed upstream.
patch to fix the bug:
  http://thread.gmane.org/gmane.comp.gnu.parted.devel/3523/focus=3524
patch to add test to exercise the fix/bug:
  http://thread.gmane.org/gmane.comp.gnu.parted.devel/3525
Comment 1 James Laska 2011-05-10 11:37:08 EDT
Easy to fix in a post-release update.  Does this impact the user during installation in any way?
Comment 2 Adam Williamson 2011-05-10 12:46:28 EDT
yeah, this doesn't immediately look blocker-worthy to me. Jim, can you explain in more detail why this should be a release blocker? Thanks!



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 3 Brian Lane 2011-05-10 13:10:26 EDT
Since the install media is frozen at release I think it would be nice to have this in place before then. I can think of any specific install cases where this would come up, but you know those crazy users... :)
Comment 4 Hans de Goede 2011-05-10 13:15:45 EDT
(In reply to comment #3)
> Since the install media is frozen at release I think it would be nice to have
> this in place before then.

I agree.

> I can think of any specific install cases where this
> would come up, but you know those crazy users... :)

I can make one up for you, system with 17 partitions, boot live cd mount 17th partition and make it busy (cd into the mount point in a shell for example).

Start livecd install, modify 17th partition, ugly stuff happens.

Not really a blocker blocker, but definitely very good to have fixed.
Comment 5 Hans de Goede 2011-05-10 13:16:10 EDT
Or more likely the same with any dmraid partition.
Comment 6 James Laska 2011-05-10 13:31:59 EDT
Based on the corner-case supplied, my opinion based on the current release criteria ...

-1 Blocker, +1 NTH

I'd suggest patching and building an update quickly to ensure NTH is still an option.
Comment 7 Adam Williamson 2011-05-10 13:42:12 EDT
agree with jlaska, i can't see this as a blocker but nth, sure.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 8 Adam Williamson 2011-05-10 14:53:08 EDT
i'm kicking this down to nth to keep the blocker list clean, there's no real chance this would get accepted as blocker with more votes i don't think.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 9 Fedora Update System 2011-05-10 17:07:35 EDT
parted-2.3-8.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/parted-2.3-8.fc15
Comment 10 Fedora Update System 2011-05-11 01:49:00 EDT
Package parted-2.3-8.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing parted-2.3-8.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/parted-2.3-8.fc15
then log in and leave karma (feedback).
Comment 11 Jim Meyering 2011-05-12 14:00:28 EDT
FYI, I've tested parted-2.3-8.fc15 by running this bourne shell code,
derived from the test I added to parted's test suite:

sector_size_=512
ss=$sector_size_
partition_sectors=2048
n_partitions=17
start=2048
gpt_slop=34
n_sectors=$((start + n_partitions * partition_sectors + gpt_slop))
sectors_per_MiB=$((1024 * 1024 / ss))
n_MiB=$(((n_sectors + sectors_per_MiB - 1) / sectors_per_MiB))

modprobe scsi_debug dev_size_mb=$n_MiB

# FIXME: CAUTION: you must set scsi_dev here.  Set it to
# the name of the device you've just created, e.g., /dev/sdX
# To see which to use, run dmesg|tail
# scsi_dev=/dev/sdX
parted -s $scsi_dev mklabel gpt

i=1
while :; do
    end=$((start + partition_sectors - 1))
    parted -s $scsi_dev mkpart p$i ${start}s ${end}s
    test $i = $n_partitions && break
    start=$((start + partition_sectors))
    i=$((i+1))
done

mkdir m-16

# wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear
# NOTE: you may have to wait a few seconds, here.

mkfs.ext3 -q /dev/sdd16
mount /dev/sdd16 m-16
parted -s $scsi_dev rm 16

# The above exited nonzero, now that it has the fix.
# Here's the required (new) output that I saw:
Error: Partition /dev/sdd16 is being used. You must unmount it before you modify it with Parted.


# cleanup
umount m-16
rmdir m-16
rmmod scsi_debug
Comment 12 Fedora Update System 2011-05-14 00:07:45 EDT
parted-2.3-8.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.