[转载]Linux下reload ASM的UDEV rule,是否有影响

本文介绍了如何解决Udev rules频繁重启导致Oracle ASM服务的问题,关键在于识别并临时禁用inotify watch事件。通过创建udev规则文件和使用`udevadm`命令调整规则,确保只针对Oracle ASM设备应用'nowatch'选项,以避免假阳性事件干扰生产环境。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考文档:

Udev rules are getting reloaded frequently and causing Oracle ASM outage - Red Hat Customer Portal

 

Resolution

  • 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 close it, then it could synthesise a change event. And this change event reloads the udev rules configured with ACTION=="add|change".

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

    Raw

    $ 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:

    Raw

    $ 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.

    1. Before applying any changes, read through the following KCS documents to ensure you understand what Oracle ASM devices are being used in your environment:

    2. Create a udev rule file /etc/udev/rules.d/96-asm-device.rules and set nowatch option:

      Raw

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

      If you're using ASM on multipath devices, you'll need to change the "sd" to "dm" as shown in the following example:

      Raw

      ACTION=="add|change", KERNEL=="dm-*", OPTIONS:="nowatch"
      
    3. Then use below commands to reload the udev rules configuration:

      Raw

      $ /sbin/udevadm control --reload-rules
      $ /sbin/udevadm trigger --type=devices --action=change
      

    Note:

    • 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 change required to accommodate the devices used by Oracle ASM. Please get in touch with Red Hat support representative for assistance in setting up the udev rules to selectively disable the 'inotify' watch for the devices used by Oracle ASM.

    • The 'nowatch' option would only disable the 'inotify' watch events. The inotify API provides a mechanism for monitoring the filesystem events. It is used to monitor the individual files or to monitor directories. So, setting the 'nowatch' option for devices does not disable any existing device specific udev rules and any changes to underlying disk (e.g. add/remove/change) would still trigger the udev rules as expected.

详细内容,可以参考转载的文档。

END。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值