• Alexander Aring's avatar
    fs: dlm: add shutdown hook · 9d232469
    Alexander Aring authored
    This patch fixes issues which occurs when dlm lowcomms synchronize their
    workqueues but dlm application layer already released the lockspace. In
    such cases messages like:
    
    dlm: gfs2: release_lockspace final free
    dlm: invalid lockspace 3841231384 from 1 cmd 1 type 11
    
    are printed on the kernel log. This patch is solving this issue by
    introducing a new "shutdown" hook before calling "stop" hook when the
    lockspace is going to be released finally. This should pretend any
    dlm messages sitting in the workqueues during or after lockspace
    removal.
    
    It's necessary to call dlm_scand_stop() as I instrumented
    dlm_lowcomms_get_buffer() code to report a warning after it's called after
    dlm_midcomms_shutdown() functionality, see below:
    
    WARNING: CPU: 1 PID: 3794 at fs/dlm/midcomms.c:1003 dlm_midcomms_get_buffer+0x167/0x180
    Modules linked in: joydev iTCO_wdt intel_pmc_bxt iTCO_vendor_support drm_ttm_helper ttm pcspkr serio_raw i2c_i801 i2c_smbus drm_kms_helper virtio_scsi lpc_ich virtio_balloon virtio_console xhci_pci xhci_pci_renesas cec qemu_fw_cfg drm [last unloaded: qxl]
    CPU: 1 PID: 3794 Comm: dlm_scand Tainted: G        W         5.11.0+ #26
    Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.13.0-2.module+el8.3.0+7353+9de0a3cc 04/01/2014
    RIP: 0010:dlm_midcomms_get_buffer+0x167/0x180
    Code: 5d 41 5c 41 5d 41 5e 41 5f c3 0f 0b 45 31 e4 5b 5d 4c 89 e0 41 5c 41 5d 41 5e 41 5f c3 4c 89 e7 45 31 e4 e8 3b f1 ec ff eb 86 <0f> 0b 4c 89 e7 45 31 e4 e8 2c f1 ec ff e9 74 ff ff ff 0f 1f 80 00
    RSP: 0018:ffffa81503f8fe60 EFLAGS: 00010202
    RAX: 0000000000000008 RBX: ffff8f969827f200 RCX: 0000000000000001
    RDX: 0000000000000000 RSI: ffffffffad1e89a0 RDI: ffff8f96a5294160
    RBP: 0000000000000001 R08: 0000000000000000 R09: ffff8f96a250bc60
    R10: 00000000000045d3 R11: 0000000000000000 R12: ffff8f96a250bc60
    R13: ffffa81503f8fec8 R14: 0000000000000070 R15: 0000000000000c40
    FS:  0000000000000000(0000) GS:ffff8f96fbc00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 000055aa3351c000 CR3: 000000010bf22000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     dlm_scan_rsbs+0x420/0x670
     ? dlm_uevent+0x20/0x20
     dlm_scand+0xbf/0xe0
     kthread+0x13a/0x150
     ? __kthread_bind_mask+0x60/0x60
     ret_from_fork+0x22/0x30
    
    To synchronize all dlm scand messages we stop it right before shutdown
    hook.
    Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
    Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
    9d232469
lockspace.c 20.3 KB