Udev rules are getting reloaded frequently and causing Oracle ASM outage

Solution verified - Updated on

Request a new translation or translation update

A translation for your language preference does not exist. Click below to request a translation for your selected language.

Submit request

Red Hat Lightspeed can detect this issue

Proactively detect and remediate issues impacting your systems.

View matching systems and remediation

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Oracle DB using ASM disks managed by udev

Issue

  • Udev rules are getting reloaded frequently and causing Oracle ASM outage.
  • After installing tuned on system, we are getting high SYS CPU at specific times when the tuned-mpath-iosched rule is triggered from /lib/udev.

Resolution

To suppress false-positive change uevents, disable the inotify watch for the devices used by Oracle ASM by setting OPTIONS+="nowatch" in the custom udev rules:

  1. Identify the block devices used by Oracle ASM and ensure Oracle's afd_filter issue has been addressed. Refer to the following documents for guidance:
    systemd-udev is causing high CPU utilization on RHEL with Oracle Database server
    How to create Oracle ASM disks using disk or multipath devices in Red Hat Enterprise Linux?
    How to make sure Oracle ASM devices pointing to multipath devices and not scsi paths, sd devices when using ASMLib to manage ASM disks?

  2. Create a udev rule file /etc/udev/rules.d/96-asm-device.rules and set the nowatch option. Keep it in its own file with a higher leading number than any existing Oracle rules so it loads last. If your existing Oracle ASM ownership/symlink rules already start with 99-, renumber them (e.g., to 95-) so the nowatch file runs after them.

  • Choose the rule matching your underlying block device layer:

Option 1: If ASM uses standard sd devices, add:

ACTION=="add|change", KERNEL=="sd*", OPTIONS:="nowatch"

Option 2: If ASM uses multipath devices, add:

ACTION=="add|change", KERNEL=="dm-*", OPTIONS:="nowatch"
  • If the Oracle AFD driver (oracleafd) is also in use, disable nowatch option on disks created under /dev/oracleafd/disks path as well:
ACTION=="add|change", KERNEL=="oracleafd/.*", OPTIONS:="nowatch"
ACTION=="add|change", KERNEL=="oracleafd/*", OPTIONS:="nowatch"
ACTION=="add|change", KERNEL=="oracleafd/disks/*", OPTIONS:="nowatch"
  1. Reload the udev rules configuration:
$ /sbin/udevadm control --reload-rules
$ /sbin/udevadm trigger --type=devices --action=change

Notes:
- The above commands will reload the complete udev configuration and will trigger all the udev rules. On a busy production system this could disrupt the ongoing IO operations. So it would be recommended to please use the above commands during a scheduled maintenance window only.
- The udev rule shown in above snip is provided as an example, there may be further changes required to accommodate the devices used by Oracle ASM. If you have any questions please contact Red Hat Support.

Root Cause

  • There was a known issue with inotify watch events configured in the udev rules. Due to this, when a process opens a device for write operation, and then closes it, it could synthesise a change event. This is because, if the disk is modified, the disk label, UUID, or partitions or anything else for the disk could have changed. The udev daemon has to rescan the disk and update the udev database accordingly. Due to this change event on disk devices, any udev rules having ACTION=="add|change" will get reloaded.

    The udev man page describes the watch and nowatch options for inotify:

    $ man udev
    [...]
       watch
           Watch the device node with inotify, when closed after being opened for writing, a change uevent will be synthesised.
    
       nowatch
           Disable the watching of a device node with inotify.
    [...]
    

    The 'inotify' watch and change event is turned on for most of the devices:

    $ fgrep watch -r /lib/udev/rules.d/* | fgrep OPTIONS
    lib/udev/rules.d/10-dm.rules:OPTIONS:="nowatch"
    lib/udev/rules.d/11-dm-lvm.rules:OPTIONS:="nowatch"
    lib/udev/rules.d/13-dm-disk.rules:OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL!="xvd*|sr*", OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL=="xvd*", ENV{DEVTYPE}!="partition", ATTR{removable}!="1", OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL=="xvd*", ENV{DEVTYPE}=="partition", OPTIONS+="watch"
    lib/udev/rules.d/64-md-raid.rules:OPTIONS+="watch"
    lib/udev/rules.d/80-udisks.rules:# KERNEL=="dm-*", OPTIONS+="watch"
    
  • To suppress the false positive 'change' events, disable the inotify watch for the devices used by Oracle ASM.

  • Setting OPTIONS:="nowatch" only suppresses close()-triggered events, leaving existing ASM rules and genuine disk uevents unaffected.

Diagnostic Steps

  • Run following commands from separate terminals and monitor the output to verify if there are any frequent change events triggered for the disks:

    # udevadm monitor --property
    # udevadm monitor --kernel
    # udevadm monitor --udev
    

    or provide the output to Red Hat Support:

    # udevadm monitor --property  &>>  /tmp/udevadm_monitor_property
    # udevadm monitor --kernel  &>>  /tmp/udevadm_monitor_kernel
    # udevadm monitor --udev  &>> /tmp/udevadm_monitor_udev
    
  • Here is an example of an open test case with no write triggering the rule:

    ./check_udev /dev/mapper/mpathmn
     Opened file /dev/mapper/mpathmn with descriptor 3
    
    KERNEL[1433182713.102117] change   /devices/virtual/block/dm-1 (block)
    UDEV  [1433182713.823458] change   /devices/virtual/block/dm-1 (block)
    
    'check_udev.c' program used for binary 'check_udev':
     #include <stdio.h>
     #include <stdlib.h>
     #include <sys/types.h>
     #include <sys/stat.h>
     #include <fcntl.h>
    
     int main(int argc, char*argv[])
     {
     int fd;
     fd=open(argv[1],O_RDWR,0660);
     printf("Opened file %s with descriptor %d\n",argv[1],fd);
     close(fd);
     }
    
  • Check the system udev rules for OPTIONS+="watch", which enables inotify watches that generate change events during device open/close operations:

    $ fgrep watch -r /lib/udev/rules.d/* | fgrep OPTIONS
    lib/udev/rules.d/10-dm.rules:OPTIONS:="nowatch"
    lib/udev/rules.d/11-dm-lvm.rules:OPTIONS:="nowatch"
    lib/udev/rules.d/13-dm-disk.rules:OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL!="xvd*|sr*", OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL=="xvd*", ENV{DEVTYPE}!="partition", ATTR{removable}!="1", OPTIONS+="watch"
    lib/udev/rules.d/60-persistent-storage.rules:KERNEL=="xvd*", ENV{DEVTYPE}=="partition", OPTIONS+="watch"
    lib/udev/rules.d/64-md-raid.rules:OPTIONS+="watch"
    lib/udev/rules.d/80-udisks.rules:# KERNEL=="dm-*", OPTIONS+="watch"
    

This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.