- 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
Udev rules are getting reloaded frequently and causing Oracle ASM outage
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.
Red Hat Lightspeed can detect this issue
Proactively detect and remediate issues impacting your systems.
Environment
Issue
- Udev rules are getting reloaded frequently and causing Oracle ASM outage.
- After installing
tunedon system, we are getting high SYS CPU at specific times when thetuned-mpath-ioschedrule 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:
-
Identify the block devices used by Oracle ASM and ensure Oracle's
afd_filterissue 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? -
Create a udev rule file
/etc/udev/rules.d/96-asm-device.rulesand set thenowatchoption. 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 with99-, renumber them (e.g., to95-) so thenowatchfile 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, disablenowatchoption on disks created under/dev/oracleafd/diskspath as well:
ACTION=="add|change", KERNEL=="oracleafd/.*", OPTIONS:="nowatch"
ACTION=="add|change", KERNEL=="oracleafd/*", OPTIONS:="nowatch"
ACTION=="add|change", KERNEL=="oracleafd/disks/*", OPTIONS:="nowatch"
- 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
inotifywatch 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 thischangeevent on disk devices, anyudevrules havingACTION=="add|change"will get reloaded.The udev man page describes the
watchandnowatchoptions forinotify:$ 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
inotifywatch 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
changeevents triggered for the disks:# udevadm monitor --property # udevadm monitor --kernel # udevadm monitor --udevor 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 enablesinotifywatches 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.