7ca6eca dlm_controld: better uevent filtering

Authored and Committed by aring 2 years ago
    dlm_controld: better uevent filtering
    
    When I did test with dlm_locktorture module I got several log messages
    about:
    
    uevent message has 3 args: add@/module/dlm_locktorture
    uevent message has 3 args: remove@/module/dlm_locktorture
    
    which are not expected and not able to parse by dlm_controld
    process_uevent() function, because mismatch of argument counts.
    Debugging it more, I figured out that those uevents are for
    loading/unloading the dlm_locktorture module and there are uevents for
    loading and unloading modules which have nothing todo with dlm lockspace
    uevent handling.
    
    The current filter works as:
    
    if (!strstr(buf, "dlm"))
    
    for matching the dlm joining/leaving uevent string which looks like:
    
    offline@/kernel/dlm/locktorture
    
    to avoid matching with other uevent which has somehow the string "dlm"
    in it, we switch to the match the uevent env variables for action,
    devpath (just to check if it's set) and subsystem. Additional the dlm
    subsystem sets the LOCKSPACE variable which can be used to get the
    lockspace name instead of extracting it previously from the devpath.
    
    The code to decode the uevent envs were taken from the gfs2_controld
    utility [0].
    
    [0] https://github.com/andyprice/gfs2-utils/blob/91c3e9a69ed70d3d522f5b47015da5e5868722ec/group/gfs_controld/main.c
    
        
file modified
+71 -55