<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - StopWhenUnneeded=yes does not stop service even though there's nothing depending on it"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=69989">69989</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>StopWhenUnneeded=yes does not stop service even though there's nothing depending on it
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brunocodutra@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have a very simple mount file like follows

[Unit]
BindsTo=dev-disk-by\<DEVICE DESCRIPTOR>.device
Conflicts=umount.target
Before=umount.target
After=dev-disk-by\<DEVICE DESCRIPTOR>.device
StopWhenUnneeded=true

[Mount]
What=/dev/disk/by-uuid/<DEVICE UUID>
Where=/mount/point
Type=ext4

I also have a service which BindsTo and is set to be executed After the
previous mount file. 

When this service is started, after plugging the device in and having udev
detect it, the mount file is started as expected and the mount point
successfully established. The service executes a simple task and finishes
successfully. The mount file is expected to be sopped given StopWhenUnneeded is
set to true, but that does not occur and the mount point is left mounted until
manual intervention.

In a previous version, which I sadly cannot precise, this setup used to behave
as expected.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>