<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div><br>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>&lt;<a href="mailto:devel-bounces@openvz.org">devel-bounces@openvz.org</a>&gt; on behalf of Kir Kolyshkin &lt;<a href="mailto:kir@openvz.org">kir@openvz.org</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Friday 15 April 2016 01:35<br>
<span style="font-weight:bold">To: </span>&quot;<a href="mailto:devel@openvz.org">devel@openvz.org</a>&quot; &lt;<a href="mailto:devel@openvz.org">devel@openvz.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>[Devel] O_NONBLOCK for directory<br>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF">I am reviewing recent VZ7 libploop commits, in particular, this one:<br>
<br>
&nbsp; <a class="moz-txt-link-freetext" href="https://src.openvz.org/projects/OVZ/repos/ploop/commits/36df847b9">
https://src.openvz.org/projects/OVZ/repos/ploop/commits/36df847b9</a><br>
<br>
I left a question there, let me repeat it here in a hope someone answers.<br>
<br>
<blockquote type="cite">
<div class="changeset-badge-oneline" style="margin: 0px; padding:
        0px; display: inline-block; font-size: 14px; color: rgb(51, 51,
        51); font-family: Arial, sans-serif; font-style: normal;
        font-variant: normal; font-weight: normal; letter-spacing:
        normal; line-height: 20px; orphans: auto; text-align: left;
        text-indent: 0px; text-transform: none; white-space: normal;
        widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
        background-color: rgb(255, 255, 255);">
<span class="changeset-author" title="Igor Sukhih" style="font-weight: bold; margin-right: 5px; color: rgb(51,
          51, 51);">Igor Sukhih</span><span class="Apple-converted-space">&nbsp;</span>committed<span class="Apple-converted-space">&nbsp;</span><a class="changesetid" href="https://src.openvz.org/projects/OVZ/repos/ploop/commits/36df847b99c92557c69255ebfb00d4cc74cb51ac" data-changeset-id="36df847b99c92557c69255ebfb00d4cc74cb51ac" original-title="" style="color: rgb(59, 115, 175);
          text-decoration: none; font-family: monospace; display:
          inline-block; vertical-align: baseline; margin-left: 5px;">36df847b99c</a><time title="13 April 2016 05:04 PM" datetime="2016-04-13T17:04:27&#43;0000" style="margin-left: 5px;
          font-size: 12px; color: rgb(112, 112, 112);">Yesterday</time></div>
<div class="commit-message" style="margin: 10px 0px 0px; padding:
        0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif;
        font-size: 14px; font-style: normal; font-variant: normal;
        font-weight: normal; letter-spacing: normal; line-height: 20px;
        orphans: auto; text-align: left; text-indent: 0px;
        text-transform: none; white-space: normal; widows: 1;
        word-spacing: 0px; -webkit-text-stroke-width: 0px;
        background-color: rgb(255, 255, 255);">
<pre style="margin: 0px; padding: 0px; white-space: pre-wrap;">ploop_copy_init(): open folder with O_DIRECTORY flag
</pre>
</div>
<br class="Apple-interchange-newline">
</blockquote>
...<br>
<blockquote type="cite"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _h-&gt;mntfd = open(mnt, O_RDONLY);</tt><tt><br>
</tt><tt>&#43;</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _h-&gt;mntfd = open(mnt, O_RDONLY|O_NONBLOCK|O_DIRECTORY);</tt><tt><br>
</tt></blockquote>
<br>
1. What's the reason for adding O_NONBLOCK here? As far as I can see, it doesn't<br>
change anything at all (neither in this open(), nor in subsequent syncfs(), ioctl()<br>
and close())? I went as far as the kernel sources to check that O_NONBLOCK<br>
doesn't affect syncfs() call, but maybe I'm mistaken?</div>
</div>
</blockquote>
</span>
<div><br>
</div>
<div>Added accidentally, you are right, it doesn't change anything.</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF"><br>
<br>
2. What's the reason for adding O_DIRECTORY? Ideally, the changelog<br>
should say why we're doing it, not what we do (as it's pretty clear<br>
from the patch itself).</div>
</div>
</blockquote>
</span>
<div>It does exactly as specified &#8211; enforces open file to be a directory. Any problems with this enforcement?</div>
<div><br>
</div>
<div>Thank you,</div>
<div>Dmitry.</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF"><br>
<br>
Regards,<br>
&nbsp; Kir.<br>
<br>
<br>
</div>
</div>
</blockquote>
</span>
</body>
</html>