From: David Lehman dlehman@redhat.com
udev generates ("synthesizes") a change event whenever a read/write file descriptor to a block device is closed, so there is no reason we should have to notify the kernel ourselves after writing to a block device. --- blivet/devices/storage.py | 17 ----------------- blivet/formats/__init__.py | 30 ------------------------------ blivet/formats/fs.py | 6 ------ 3 files changed, 53 deletions(-)
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py index c91b9d1..5b2a3fa 100644 --- a/blivet/devices/storage.py +++ b/blivet/devices/storage.py @@ -301,23 +301,6 @@ def resizable(self): (self.format.type is None or self.format.resizable or not self.format.exists))
- def notify_kernel(self): - """ Send a 'change' uevent to the kernel for this device. """ - log_method_call(self, self.name, status=self.status) - if not self.exists: - log.debug("not sending change uevent for non-existent device") - return - - if not self.status: - log.debug("not sending change uevent for inactive device") - return - - path = os.path.normpath(self.sysfs_path) - try: - util.notify_kernel(path, action="change") - except (ValueError, IOError) as e: - log.warning("failed to notify kernel of change: %s", e) - @property def fstab_spec(self): spec = self.path diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py index d67d6f4..77d795a 100644 --- a/blivet/formats/__init__.py +++ b/blivet/formats/__init__.py @@ -29,7 +29,6 @@ import os import importlib
-from ..util import notify_kernel from ..util import get_sysfs_path_by_name from ..util import run_program from ..util import ObjectID @@ -353,33 +352,6 @@ def name(self): def type(self): return self._type
- def notify_kernel(self): - log_method_call(self, device=self.device, - type=self.type) - if not self.device: - return - - if self.device.startswith("/dev/mapper/"): - try: - name = blockdev.dm.node_from_name(os.path.basename(self.device)) - except blockdev.DMError: - log.warning("failed to get dm node for %s", self.device) - return - elif self.device.startswith("/dev/md/"): - try: - name = blockdev.md.node_from_name(os.path.basename(self.device)) - except blockdev.MDRaidError: - log.warning("failed to get md node for %s", self.device) - return - else: - name = self.device - - path = get_sysfs_path_by_name(name) - try: - notify_kernel(path, action="change") - except (ValueError, IOError) as e: - log.warning("failed to notify kernel of change: %s", e) - def create(self, **kwargs): """ Write the formatting to the specified block device.
@@ -423,7 +395,6 @@ def _create(self, **kwargs): # pylint: disable=unused-argument def _post_create(self, **kwargs): self.exists = True - self.notify_kernel()
def destroy(self, **kwargs): """ Remove the formatting from the associated block device. @@ -465,7 +436,6 @@ def _destroy(self, **kwargs):
def _post_destroy(self, **kwargs): self.exists = False - self.notify_kernel()
@property def destroyable(self): diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py index 9e35dd0..cb105c4 100644 --- a/blivet/formats/fs.py +++ b/blivet/formats/fs.py @@ -515,7 +515,6 @@ def do_resize(self):
# XXX must be a smarter way to do this self._size = self.target_size - self.notify_kernel()
def do_check(self): """ Run a filesystem check. @@ -747,7 +746,6 @@ def write_label(self): raise FSError("device does not exist")
self._writelabel.do_task() - self.notify_kernel()
@property def utils_available(self): @@ -1230,10 +1228,6 @@ def _device_check(self, devspec): def type(self): return self.device
- def notify_kernel(self): - # NoDevFS should not need to tell the kernel anything. - pass - register_device_format(NoDevFS)
anaconda-patches@lists.fedorahosted.org