GNOME Bugzilla – Bug 611431
Ensure no pending operations before swapon and mount
Last modified: 2010-09-23 16:57:52 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
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).
This happned using the ubuntu 9.10 live CD, it appeared as Swap ON in geparted using the live CD.
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?
It was on by default
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.
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.
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).
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?
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.
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.
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.
With the suggested solution in comment #11, a more encompassing title would be: "Ensure no pending operations before swapon/swapoff and mount/unmount"
Ok, that sounds like a good solution. I don't know how to change the topic.
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"
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"
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
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.