Re: [PATCH 2/3] Do not try to commit disks changes to the os while partitions are in use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 08/26/2009 07:54 PM, David Lehman wrote:
On Wed, 2009-08-26 at 11:45 +0200, Hans de Goede wrote:
In storage.doIt() we set the bootable flag for the /boot or / (or
special platform boot) partition. And then we call bootdev.format.commit(),
however this will lead to parted trying to tell the kernel to rescan the
partition table which will usually fail, as usually we have some VolGroup
active at this point.

All we really need todo is make sure the bootable flag gets written to the
disk, so this patch adds a commitToDisk() method to formats.disklabel and uses
that.

Should we pack this into a retry loop like we do for disk.commit?


No the commit_to_device never fails (unless the base device node is gone or not
writable, in which case we are in deep shit). I wonder why we even do the retry for
the commit_to_os, I guess because sometimes it fails due to issues discussed earlier
today. I think once those issues are fixed we can even stop retrying there.

Regards,

Hans



Dave


We were not bitten by this before because uptil now parted was silently
ignoring ebusy errors for us (BAD parted, BAD!).
---
  storage/__init__.py          |    2 +-
  storage/formats/disklabel.py |    7 +++++++
  2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index de34051..d05a8a5 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -238,7 +238,7 @@ class Storage(object):
          else:
              if hasattr(boot, "bootable"):
                  boot.bootable = True
-                boot.disk.format.commit()
+                boot.disk.format.commitToDisk()

      @property
      def nextID(self):
diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py
index b3b81ed..08e2461 100644
--- a/storage/formats/disklabel.py
+++ b/storage/formats/disklabel.py
@@ -208,6 +208,13 @@ class DiskLabel(DeviceFormat):
          if keepTrying:
              raise DeviceFormatError("cannot commit to disk after %d attempts" % (maxTries,), )

+    def commitToDisk(self):
+        """ Commit the current partition table to disk. """
+        try:
+            self.partedDisk.commitToDevice()
+        except parted.DiskException as msg:
+            raise DeviceFormatError(msg)
+
      def addPartition(self, *args, **kwargs):
          partition = kwargs.get("partition", None)
          if not partition:

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux