<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Hello,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>at our institute we are experiencing some problems
concerning unionfs in combination with NFS.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The scenario is the following:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>We have a server with an NFSv3-export (set to ro). Clients mount
this nfs-export (ro as well) and unionfs is used to merge it with a tmpfs.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Adding and deleting files works as expected. However, if a
file is opened (which according to ls &#8211;l has write permission) which only
exists in the ro branch it is recognized as readonly. Only forcing a write can
make changes to the file. For &#8220;echo &gt;&#8221; or &#8220;echo
&gt;&gt;&#8221; on an existing files I receive a &#8220;Permission
denied&#8221;.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Here an example:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>&gt; cd /root/unionfs_test/union/usr<o:p></o:p></p>

<p class=MsoNormal>&gt; ls &#8211;l test<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>-rwxrwxrwx 1 root root 8 Jul 24 15:45 test<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>&gt; strace -e file /bin/bash -c 'echo &gt; test'<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>execve(&quot;/bin/bash&quot;, [&quot;/bin/bash&quot;,
&quot;-c&quot;, &quot;echo &gt; test&quot;], [/* 48 vars */]) = 0<o:p></o:p></p>

<p class=MsoNormal>access(&quot;/etc/ld.so.preload&quot;,
R_OK)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = -1 ENOENT (No such file or directory)<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/etc/ld.so.cache&quot;,
O_RDONLY)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/lib/libncurses.so.5&quot;, O_RDONLY)&nbsp; = 3<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/lib/libdl.so.2&quot;,
O_RDONLY)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;= 3<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/lib/libc.so.6&quot;,
O_RDONLY)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/dev/tty&quot;, O_RDWR|O_NONBLOCK|O_LARGEFILE) =
3<o:p></o:p></p>

<p class=MsoNormal>open(&quot;/proc/meminfo&quot;,
O_RDONLY)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3<o:p></o:p></p>

<p class=MsoNormal>stat64(&quot;/root/unionfs_test/union/usr&quot;, {st_mode=S_IFDIR|0755,
st_size=40, ...}) = 0<o:p></o:p></p>

<p class=MsoNormal>stat64(&quot;.&quot;, {st_mode=S_IFDIR|0755, st_size=40,
...}) = 0<o:p></o:p></p>

<p class=MsoNormal>open(&quot;test&quot;, O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE,
0666) = -1 EACCES (Permission denied)<o:p></o:p></p>

<p class=MsoNormal>/bin/bash: test: Permission denied<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>After I first forced a write, did a chmod, touch, etc.
everything works fine. Also if the file does not exist beforehand. So I guess
this is again one of those problems where no copy-up is triggered because NFS
is answering EACCES instead of EROFS? However, I have marked the branch as ro
and the mount is ro as well. Can this problem still occur?<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Here my system setup, an expert from the /etc/exports on the
server and the commands to reproduce the effect on the clients.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Server: Gentoo linux, 64 Bit, gentoo kernel
2.6.26-hardened-r9, export using NFSv3<o:p></o:p></p>

<p class=MsoNormal>Client: &nbsp;&nbsp;Gentoo linux, 32 Bit, vanilla kernel
2.6.29.4 with unionfs 2.5.2 patch and ipipe patch<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Exports (excerpt):<o:p></o:p></p>

<p class=MsoNormal>/lb/diskless/rootfs&nbsp;&nbsp;&nbsp;
xxx.xxx.xxx.0/24(ro,fsid=100,mp=/lb,async,no_root_squash,no_subtree_check) <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>cat /proc/mounts (on server, excerpt)<o:p></o:p></p>

<p class=MsoNormal>/dev/sdc1 /lb ext3 rw,noatime,errors=continue,data=ordered 0
0<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Mount commands on client:<o:p></o:p></p>

<p class=MsoNormal>mkdir nfs tmpfs union<o:p></o:p></p>

<p class=MsoNormal>mount -nt nfs -o ro,nolock server:/lb/diskless/rootfs
/root/unionfs_test/nfs<o:p></o:p></p>

<p class=MsoNormal>mount -nt tmpfs tmpfs /root/unionfs_test/tmpfs<o:p></o:p></p>

<p class=MsoNormal>mount -nt unionfs -o rw,dirs=/root/unionfs_test/tmpfs=rw:
/root/unionfs_test/nfs=ro unionfs /root/unionfs_test/union<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>This seems to be the same problem as reported in Bugzilla
Bug 624 <a href="https://bugzilla.filesystems.org/show_bug.cgi?id=624">https://bugzilla.filesystems.org/show_bug.cgi?id=624</a>.
I did some tests and found out that, also for me, the problem is
&#8220;solved&#8221; if the export is set to rw. However, exporting the
filesystem as rw doesn&#8217;t seem like an alternative, mainly for security
reasons, i.e. unionfs is currently not usable for us. So for the moment we are
stuck with unionfs-fuse which does not have this problem but obviously has a
huge impact on performance.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Is there a plan to solve this issue or is there any workaround?<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Thomas</span><o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>