Proxmox Workaround: Destroy stubborn containers

More than once now i have run into an error removing a container from Proxmox v4.4. Note that i believe this only occurs on disk images kept in ZFS pools so if you're using a non-ZFS file system this wont apply.

The error i've gotten when attempting to remove a container is "TASK ERROR: zfs error: cannot destroy 'vpool/subvol-104-disk-1': dataset is busy"

From what i can tell the dataset is kept busy by processes run by ZFS that i'm assuming are part of it's data integrity checks. Rebooting the server is one way to halt these processes and remove the container, but if you're like me and looking for that sweet sweet extended up time, that's not an option.

So after digging i found this solution:

SSH into the host and navigate to the ZFS pool where your disk images are kept.
Use "ls" to get a list of disk image containers and identify the stubborn bastard
Run: "grep rpool/data/subvol-1-disk-1 /proc/*/mounts" where rpool/bla/bla/bla-bla is the container.
The output should resemble something like "/proc/31571/mounts:rpool/data/subvol-1-disk1 /rpool/data/subvol-1-disk-1 zfs rw,relatime,xattr,posixacl 0 0
There may be more than one process associated with that disk image
Use the "kill" command and process number, in this case 31571, to end each process.
Now you should be able to either user "zfs destroy rpool/data/subvol-1-disk-1" or the GUI to remove the container.

Note: you will need to run these commands as sudo if you're not logged in as root.

I know it's not a particularly clean or elegant fix, but it took me a while to dig this up and i thought it may come in handy if someone else in the community encounters this.