After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611431 - Ensure no pending operations before swapon and mount
Ensure no pending operations before swapon and mount
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.4.5
Other Linux
: Normal minor
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2010-02-28 22:24 UTC by Anders Jenbo
Modified: 2010-09-23 16:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screen shot of GParted warning to prevent swapon with partition in operations queue (17.33 KB, image/png)
2010-08-09 19:45 UTC, Curtis Gedak
Details

Description Anders Jenbo 2010-02-28 22:24:57 UTC
If you quie up a resize of a swap partition and then right click it and select enable spaw. The swap will be enabled instantly and from now on show up in gparted as the final size (the resize was never done), even after reboot.
But the swap will still have the effective size as befor the size was suposed to take effect.
This was observed on a Ubuntu 9.10 machine
Comment 1 Curtis Gedak 2010-03-02 21:20:03 UTC
Thank you Anders for reporting this problem.

As a general rule, it is not possible to modify mounted file systems.  For this reason we highly recommend using Live CD's, such as GParted Live, since these do not mount the file systems (or swap space).
Comment 2 Anders Jenbo 2010-03-02 21:22:16 UTC
This happned using the ubuntu 9.10 live CD, it appeared as Swap ON in geparted using the live CD.
Comment 3 Curtis Gedak 2010-03-02 21:32:08 UTC
Was the swap space mounted by default when you booted with the Ubuntu 9.10 Live 
CD?

Or, did you decide to mount the swap space manually?
Comment 4 Anders Jenbo 2010-03-02 21:40:48 UTC
It was on by default
Comment 5 Curtis Gedak 2010-03-02 21:45:36 UTC
Interesting.

Did you receive an error message when you applied the swap space resize operation?

Prior to GParted 0.5.1, some errors were not recognized and relayed on to the user.
Comment 6 Curtis Gedak 2010-06-01 22:11:30 UTC
Closing this bug report as there has been no response to the question in comment #5.

If you can answer this question or provide additional information, then please feel free to re-open this bug report and provide further details.
Comment 7 Anders Jenbo 2010-06-02 00:50:49 UTC
No i did not get an error. I never applied the change, i only queued it and then just closed it after the Swap ON was applied (i thought it would also be queued as the swap was pending for a resize).
Comment 8 Curtis Gedak 2010-06-02 16:08:00 UTC
Thank you Anders for responding.

From your responses, it appears that the problem arose because there is confusion between which gparted actions are queued, and which are instantly performed.

The five operations that make instant changes (not queued) to the disk or partition usage status are:
   Device --> Create Partition Table
   Partition --> Swapoff
   Partition --> Swapon
   Partition --> Unmount
   Partition --> Mount

If a gparted action was queued on a disk device and the user tried to create a new partition table on the disk device, then gparted would warn the user that the action could not be taken due to actions currently in the operation queue.

My thoughts are that adding a similar warning to these other four instantly performed actions should address this problem.

Does that sound like a reasonable solution to you, or do you have another suggestion?
Comment 9 Curtis Gedak 2010-06-02 16:14:39 UTC
Please note that the warning mentioned in comment #8 for creating a partition table on a disk device with actions queued was added as a response to the following bug report:
Bug #583896 - Ensure no pending operations before creating partition table

This enhancement was added in version 0.4.8 of GParted, so do not try testing this with lower versions of GParted.
Comment 10 Anders Jenbo 2010-06-02 16:52:08 UTC
Displaying a warning won't be enough, as the action is preformed according to the layout as if the currently queued actions where already preformed. This can result in overlapping partitions, mounting of non-existing swap partitions etc. 

A working solution would be to display a warning and then before turning the swap ON/OFF, drop all actions that affects the swap partition (probably best to drop all actions on that drive).

I am not sure about what you would do if one of the actions was to create the swap in the first place, you would probably need to do a check to see if the partition is there and error if it was not found. Even better would be to gray out the option for partitions that have not yet been created.
Comment 11 Curtis Gedak 2010-06-02 17:06:22 UTC
You are absolutely correct that a warning message is not enough.

What I meant to say is to have GParted display a warning message that the action (swapoff/swapon, unount/mount) cannot be performed because there are pending operations in the queue.  The action (swapoff/swapon, unount/mount) would not be performed.  The user would then be able to manually undoing actions in the queue.

Since the order of queue operations is important, I would not want GParted to remove operations from the queue.  Your example in the third paragraph is a good description of what could go wrong otherwise.

I think it would be wiser for the user to review and undo the actions so that they know what is being undone, and which actions might need to be queued again.
Comment 12 Curtis Gedak 2010-06-02 17:37:30 UTC
With the suggested solution in comment #11, a more encompassing title would be:

"Ensure no pending operations before swapon/swapoff and mount/unmount"
Comment 13 Anders Jenbo 2010-06-02 18:54:50 UTC
Ok, that sounds like a good solution.

I don't know how to change the topic.
Comment 14 Curtis Gedak 2010-06-02 18:56:05 UTC
Okay, I will update the title from:

"Enable of swap with in correct size damages the partition layout"

to:

"Ensure no pending operations before swapon/swapoff and mount/unmount"
Comment 15 Curtis Gedak 2010-08-09 18:10:13 UTC
After some more research into this problem, it can only occur with the swapon and mount actions.  This is because GParted does not permit queueing operations on partitions that are currently active (i.e., swap enabled, or mounted).

Renaming this title to:
"Ensure no pending operations before swapon and mount"
Comment 16 Curtis Gedak 2010-08-09 19:45:39 UTC
Created attachment 167449 [details]
Screen shot of GParted warning to prevent swapon with partition in operations queue

As seen in the above attachment, a fix for this problem has been created.  This fix has been committed to the git repository for inclusion in the next release of GParted (0.6.3).

The relevant git commits can be viewed at the following links:

Add new method partition_in_operation_queue_count
http://git.gnome.org/browse/gparted/commit/?id=44698448aa9605819166e9de07dfb7bc76a4241f

Prevent swapon and mount if partition in operation queue (#611431)
http://git.gnome.org/browse/gparted/commit/?id=a4e01bc1d68a96d183121b39c9932c38fba086c7
Comment 17 Curtis Gedak 2010-09-23 16:57:52 UTC
The enhancements to address this bug report have been included in GParted 0.6.3 which was released on September 23, 2010.

Closing this bug report.