Bug 533851

Summary: regression: partprobe stopped working
Product: [Fedora] Fedora Reporter: Michal Hlavinka <mhlavink>
Component: partedAssignee: Hans de Goede <hdegoede>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: david.duffey, hdegoede
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-10 10:54:12 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:

Description Michal Hlavinka 2009-11-09 14:29:48 UTC
Description of problem:
In fedora 12 partprobe does not work. Also gparted and others have limited functionality because of this.

Version-Release number of selected component (if applicable):
parted-1.9.0-17.fc12.x86_64

How reproducible:
always

Steps to Reproduce:
1.run partprobe as root
2.
3.
  
Actual results:

Warning: The kernel was unable to re-read the partition table on /dev/sda (Device or resource busy).  This means Linux won't know anything about the modifications you made until you reboot.  You should reboot your computer before doing anything with /dev/sda.


Expected results:
partition table re-read

Additional info:
I've checked prev version parted-1.8.8-17.fc11.x86_64 (installed temporarily with nodeps) and it works as expected

Comment 1 Hans de Goede 2009-11-10 10:54:12 UTC
Actually, the old parted had a bug where it would not report failure to re-read
the partition table even when it did fail.

If you want to partition a disk, and not require a reboot afterwards, you must make sure all partitions of the disk are not used (so not mounted, nor used for swap or as part of a raid set or volume group).

Closing this as not as bug.

Comment 2 Michal Hlavinka 2009-11-10 11:22:48 UTC
well, was it really a bug? 

1)add new partition
2)partprobe

With new version:
warning, new partition can't be used (there is no new /dev/sd?X)

With old version:
no warning, new partition can be used, neew /dev/sd?X

what's buggy on this behaviour?

Comment 3 Hans de Goede 2009-11-10 12:27:08 UTC
(In reply to comment #2)
> well, was it really a bug? 
>

Yes.
 
> 1)add new partition
> 2)partprobe
> 
> With new version:
> warning, new partition can't be used (there is no new /dev/sd?X)
> 
> With old version:
> no warning, new partition can be used, neew /dev/sd?X
> 
> what's buggy on this behaviour?  

The fact that the kernel return-ed an -EBUSY somewhere which was being completely ignored, this might happen to work in certain cases, but could lead to serious issues (think data loss) in other situations. So now we stop at the first EBUSY which is, without any doubt, the right thing to do.

Comment 4 Michal Hlavinka 2009-11-10 12:32:03 UTC
how can this lead to data loss? afaik (yes, I don't know how this work :) ) after try to re-read partition table it can be a) better if the partition was re-read OR b) with no change if it faild. Right?

Also is it that better compared to "I've modified my partition, but it's  ignored" because I didn't reboot my system?

Comment 5 Hans de Goede 2009-11-10 12:44:56 UTC
If for example a partition which is in use is made smaller, and then in the free space a new partition is created.

The old code would get an ebusy when trying to tell the kernel about the changed
partition, happily continue and make the new one, after which we have overlapping partitions. Write some data to both, and chances are one write will overwrite the other.

Really, not checking errors is not a good idea in a partitioning tool, what you are seeing is a feature meant to protect *your* data.

Comment 6 Michal Hlavinka 2009-11-10 13:14:53 UTC
I have another scenario, which I've just tried on F-12:

lets have disk with three partitions, one system, two for data, with currently using that system, so I can't umount it

I want to make second partition smaller and third partition bigger. I've moved all data to another disk for backup.

Lets say partitions are 20 GB for /, 20 GB data1, 20 GB data2

run gparted:

remove data1 and data2
create new data1 10 GB and new data2 30 GB (both unformated)
everything seems to work, there is just warning at the end (where all steps successfully completed) about limited access only

close gparted
run mkfs.something with parameters you want

-> both partitions are formated as 20 GB (I doubt anyone really reads complete output of mkfs if there is no line starting with ERROR).

mount both partition and copy data back on them

reboot and.... surprise! :)
(missing superblock for data2 and some parts of data1, both of wrong size)


so I think with not working partprobe it's not much better than it was.

Resizing mounted partition is imho quite corner case of cutting the branch you sit on and afaik it was not working even in F-11.

Comment 7 Hans de Goede 2009-11-10 13:49:25 UTC
Which part of the following message parted gave you:

"Warning: The kernel was unable to re-read the partition table on /dev/sda
(Device or resource busy).  This means Linux won't know anything about the
modifications you made until you reboot.  You should reboot your computer
before doing anything with /dev/sda."

Did you not understand ? Esp. carefully read the following part:
"you should reboot your computer before doing anything with /dev/sda."

This new behaviour is not a bug, it is a bug fix, upstream parted agrees with
me on this, and parted-2.0 does this out of the box without any Fedora added patches.

This is my last comment on this not a bug bug, if you cannot understand that catching errors is much much better then ignoring them (which happened to turn out al right in certain cases but not in all), then there is not much more I have to say.

Comment 8 Michal Hlavinka 2009-11-10 14:05:26 UTC
(In reply to comment #7)
> Which part of the following message parted gave you:
> 
> "Warning: The kernel was unable to re-read the partition table on /dev/sda
> (Device or resource busy).  This means Linux won't know anything about the
> modifications you made until you reboot.  You should reboot your computer
> before doing anything with /dev/sda."
> 
> Did you not understand ?

funny, but I did not get this message. If you re-read my comment #6, I've used gparted, not parted.

"""The kernel is unable to re-read the partition tables on the following devices:
Because of this you will only have limited access to these devices. Unmount all mounted partitions on a device to get full access."""

Ok, I have limited access, there is nothing written about successfully finished tasks are going to destroy my data.

Yes, I agree ignoring errors is bad idea, but imo 50 % working is better than 0 %.
btw, (during my quick search) I was not able to find any bug against parted with complaining about "buggy partprobe caused data loss"

my last comment, lets stop talking, it seems both of us are stubborn :o)

Comment 9 Hans de Goede 2009-11-10 14:14:52 UTC
Hehe,

Stubborn we are, but if you did not get the message I quoted, or something similar, then that is a BIG bug in gparted, so you would do good to file a bug against gparted.

Note to put in the gparted bug:
I think gparted upstream has this fixed, as they are using the new 2.0 parted, which has this behaviour too, and they grumbled a bit at first too.