Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1745723

Summary: Cannot Stop VDO Volume in use on systemd shutdown
Product: Red Hat Enterprise Linux 8 Reporter: Anthony Zone <azone>
Component: vdoAssignee: Andy Walsh <awalsh>
Status: CLOSED DUPLICATE QA Contact: vdo-qe
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: awalsh, bgurney, kwalker
Target Milestone: rcKeywords: Triaged
Target Release: 8.1Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-21 14:06:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anthony Zone 2019-08-26 18:09:37 UTC
Description of problem:

On a system halt VDO is failing to stop to properly with message:

    vdo: ERROR - cannot stop VDO volume vdo: in use

Example:

    Jul 17 15:54:17 localhost systemd[1]: Unmounting /vdomount...
    Jul 17 15:54:17 localhost kernel: XFS (dm-3): Unmounting Filesystem
    Jul 17 15:54:17 localhost systemd[1]: Unmounted /vdomount.
    Jul 17 15:54:17 localhost systemd[1]: Stopped target Network is Online.
    Jul 17 15:54:17 localhost systemd[1]: Stopped Network Manager Wait Online.
    Jul 17 15:54:17 localhost systemd[1]: Stopping VDO volume services...
    Jul 17 15:54:17 localhost vdo[2272]: vdo: ERROR - cannot stop VDO volume vdo: in use
    Jul 17 15:54:17 localhost vdo[2272]: ERROR - cannot stop VDO volume vdo: in use
    Jul 17 15:54:17 localhost vdo[2272]: Stopping VDO vdo
    Jul 17 15:54:17 localhost systemd[1]: vdo.service: Control process exited, code=exited status=5
    Jul 17 15:54:17 localhost systemd[1]: vdo.service: Failed with result 'exit-code'.
    Jul 17 15:54:17 localhost systemd[1]: Stopped VDO volume services.


Version-Release number of selected component (if applicable):

    vdo-6.2.0.298-10.el8_0.x86_64

How reproducible:

    Everytime the customer attempts to shutdown their system

Steps to Reproduce:

    1. Set up vdo with a mount point
    2. Mount and use the data in the mount
    3. Shutdown the server

Actual results:

    Jul 17 15:54:17 localhost systemd[1]: Unmounting /vdomount...
    Jul 17 15:54:17 localhost kernel: XFS (dm-3): Unmounting Filesystem
    Jul 17 15:54:17 localhost systemd[1]: Unmounted /vdomount.
    Jul 17 15:54:17 localhost systemd[1]: Stopped target Network is Online.
    Jul 17 15:54:17 localhost systemd[1]: Stopped Network Manager Wait Online.
    Jul 17 15:54:17 localhost systemd[1]: Stopping VDO volume services...
    Jul 17 15:54:17 localhost vdo[2272]: vdo: ERROR - cannot stop VDO volume vdo: in use
    Jul 17 15:54:17 localhost vdo[2272]: ERROR - cannot stop VDO volume vdo: in use
    Jul 17 15:54:17 localhost vdo[2272]: Stopping VDO vdo
    Jul 17 15:54:17 localhost systemd[1]: vdo.service: Control process exited, code=exited status=5
    Jul 17 15:54:17 localhost systemd[1]: vdo.service: Failed with result 'exit-code'.
    Jul 17 15:54:17 localhost systemd[1]: Stopped VDO volume services.

Expected results:

VDO unmounts the filesystem, stops VDO, clean shutdown

Additional info:

Right now your unit file is the following:

    # systemctl cat vdo
    # /usr/lib/systemd/system/vdo.service
    [Unit]
    Description=VDO volume services
    After=systemd-remount-fs.service

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/bin/vdo start --all --confFile /etc/vdoconf.yml
    ExecStop=/usr/bin/vdo stop --all --confFile /etc/vdoconf.yml

    [Install]
    WantedBy=multi-user.target

As the unit file is working around systemd closing the the process properly with Type=oneshot and RemainAfterExit=yes, this process is running, but you're installing it into multi-user.target.  So on shutdown there is no guarantee that a process that requires the vdo mount is going to be stopped before the vdo service is attempted to be stopped.  The dependency tree isn't being built out properly.

We would recommend changing your unit file to the following:

    # cat /etc/systemd/system/vdo.service
    [Unit]
    Description=VDO volume services
    DefaultDependencies=no
    Before=local-fs-pre.target
    Conflicts=shutdown.target

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/bin/vdo start --all --confFile /etc/vdoconf.yml
    ExecStop=/usr/bin/vdo stop --all --confFile /etc/vdoconf.yml

    [Install]
    WantedBy=local-fs-pre.target

This will make sure that VDO is started very early in the process to make sure it's there for any mount points or applications that need it, and then it is one of the last things that is shutdown.

Comment 1 Andy Walsh 2020-07-21 14:06:29 UTC
I'm pretty sure this is resolved by 1837759.   The change that went in to resolve that BZ ended up activating the blk-availability.service, which should properly tear down the stack on shutdown.

*** This bug has been marked as a duplicate of bug 1837759 ***