<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 10:54 PM, Pranith Kumar Karampuri <span dir="ltr">&lt;<a href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Anand Avati&quot; &lt;<a href="mailto:avati@gluster.org">avati@gluster.org</a>&gt;<br>
&gt; To: &quot;Pranith Kumar Karampuri&quot; &lt;<a href="mailto:pkarampu@redhat.com">pkarampu@redhat.com</a>&gt;<br>
</div><div><div class="h5">&gt; Cc: &quot;Edward Shishkin&quot; &lt;<a href="mailto:edward@redhat.com">edward@redhat.com</a>&gt;, &quot;Gluster Devel&quot; &lt;<a href="mailto:gluster-devel@gluster.org">gluster-devel@gluster.org</a>&gt;<br>

&gt; Sent: Wednesday, May 21, 2014 10:53:54 AM<br>
&gt; Subject: Re: [Gluster-devel] spurios failures in tests/encryption/crypt.t<br>
&gt;<br>
&gt; There are a few suspicious things going on here..<br>
&gt;<br>
&gt; On Tue, May 20, 2014 at 10:07 PM, Pranith Kumar Karampuri &lt;<br>
&gt; <a href="mailto:pkarampu@redhat.com">pkarampu@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; &gt; hi,<br>
&gt; &gt; &gt; &gt;      crypt.t is failing regression builds once in a while and most of<br>
&gt; &gt; &gt; &gt; the times it is because of the failures just after the remount in the<br>
&gt; &gt; &gt; &gt; script.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; TEST rm -f $M0/testfile-symlink<br>
&gt; &gt; &gt; &gt; TEST rm -f $M0/testfile-link<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Both of these are failing with ENOTCONN. I got a chance to look at<br>
&gt; &gt; &gt; &gt; the logs. According to the brick logs, this is what I see:<br>
&gt; &gt; &gt; &gt; [2014-05-17 05:43:43.363979] E [posix.c:2272:posix_open]<br>
&gt; &gt; &gt; &gt; 0-patchy-posix: open on /d/backends/patchy1/testfile-symlink:<br>
&gt; &gt; &gt; &gt; Transport endpoint is not connected<br>
&gt; &gt;<br>
&gt;<br>
&gt; posix_open() happening on a symlink? This should NEVER happen. glusterfs<br>
&gt; itself should NEVER EVER by triggering symlink resolution on the server. In<br>
&gt; this case, for whatever reason an open() is attempted on a symlink, and it<br>
&gt; is getting followed back onto gluster&#39;s own mount point (test case is<br>
&gt; creating an absolute link).<br>
&gt;<br>
&gt; So first find out: who is triggering fop-&gt;open() on a symlink. Fix the<br>
&gt; caller.<br>
&gt;<br>
&gt; Next: add a check in posix_open() to fail with ELOOP or EINVAL if the inode<br>
&gt; is a symlink.<br>
<br>
</div></div>I think I understood what you are saying. Open call for symlink on fuse mount lead to an open call again for the target on the same fuse mount.</blockquote><div><br></div><div>It&#39;s not that simple. The client VFS is intelligent enough to resolve symlinks and send open() only on non-symlinks. And the test case script was doing an obvious unlink() (TEST rm -f &lt;filename&gt;), so it was not initiated by an open() attempt in the first place. My guess is that some xlator (probably crypt?) is doing an open() on an inode and that is going through unchecked in posix. It is a bug in both the caller and posix, but the onus/responsibility is on posix to disallow open() on anything but regular files (even open() on character or block devices should not happen in posix).</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Which lead to deadlock :). That is why we disallow opens on symlink in gluster?<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><div><br></div><div>That&#39;s not just why open on symlink is disallowed in gluster, it is a more generic problem of following symlinks in general inside gluster. Symlink resolution must strictly happen only in the outermost VFS. Following symlinks inside the filesystem is not only an invalid operation, but can lead to all kinds of deadlocks, security holes (what if you opened a symlink which points to /etc/passwd, should it show the contents of the client machine&#39;s /etc/passwd or the server? Now what if you wrote to the file through the symlink? etc. you get the idea..) and wrong/weird/dangerous behaviors. This is not just related to following symlinks, even open()ing special devices.. e.g if you create a char device file with major/minor number of an audio device and wrote pcm data into it, should it play music on the client machine or in the server machine? etc. The summary is, following symlinks or opening non-regular files is VFS/client operation and are invalid operations in a filesystem context.</div>
<div><br></div></div></div></div>