A question we see over and over again is Why is umount so slow? Why does it take so long? Part of the answer was already given in an earlier blog post; here’s some more explanation.
Similar to the recent post about setting the vm.min_free_kbytes value there’s another sysctl that might improve the behaviour: the dirty ratio.
Depending on your setup and your workload (eg. within a virtual machine with little memory and much I/O) you could get into the situation that the kernel has little memory left, so wants to write some dirty pages to disk, but cannot, because for that it would need some memory free!