<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>On Tue, 2017-04-18 at 17:19 +0000, Nir Soffer wrote:</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Tue, Apr 18, 2017 at 12:23 AM Pavel Gashev <<a href="mailto:Pax@acronis.com">Pax@acronis.com</a>> wrote:<br>
</div>
<blockquote type="cite">
<div>
<div id="m_-5259840855561953756d_1492464244266" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12.0pt;color:#1f497d">
<p dir="ltr">Nir,</p>
<p dir="ltr">A process can chdir into mount point and then lazy umount it. Filesystem remains mounted while the process exists and current directory is on mounted filesystem.</p>
<p dir="ltr"># struncate -s 1g masterfs.img<br>
# mkfs.ext4 masterfs.img<br>
# mkdir masterfs<br>
# mount -o loop masterfs.img masterfs<br>
# cd masterfs<br>
# umount -l .<br>
# touch file<br>
# ls<br>
# cd ..<br>
# ls masterfs</p>
</div>
</div>
<br>
</blockquote>
<div>Interesting idea!</div>
<div><br>
</div>
<div>The only issue I see if not having a way to tell if the file system was actually</div>
<div>unmounted. Does process termination guarantee that the file system was</div>
<div>unmounted? </div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>You can double check that by deactivating underlying LV. It should not be busy.</div>
<div><br>
</div>
<div>As I understand it unmounts FS as soon as all inodes are closed. Since killing of process is closing all open inodes, you can be sure that file system is unmounted if there are no other processes. Of course this is a place for race conditions. For example,
unmounting can be stuck some time if underlying storage is unresponsive. Multipath should drop all IOs with EIO. VDSM has to wait enough time after acquiring the lock before mounting masterfs.</div>
<div><br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div>Do you know if the behaviour is documented somewhere?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>umount(8):</div>
<div><br>
</div>
<div>-l, --lazy</div>
<div>Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)</div>
<div></div>
<div><br>
</div>
<div><br>
</div>
<div>
<div dir="ltr">
<div class="gmail_quote"></div>
</div>
</div>
</body>
</html>