<br><br><div class="gmail_quote">On Mon, Apr 12, 2010 at 1:26 PM, Olivier Le Cam <span dir="ltr"><<a href="mailto:Olivier.LeCam@crdp.ac-versailles.fr">Olivier.LeCam@crdp.ac-versailles.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello there,<div class="im"><br>
<br>
Raghavendra G wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I can see three protocol calls:<br>
- client_open() (to both servers) - client_stat() (to one server only: load balancing?)<br>
- client_flush() (to both servers)<br>
<br>
<br>
io-cache indeed sends open and flush to server. This is needed for correct working of io-cache. As you've told below, since you are overriding lookup call, stat is sent to server (stat and lookup are two different calls).<br>
</blockquote>
<br></div>
OK. So no easy workaround can get rid of that. Right?</blockquote><div><br>you've to override stat also.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
since lookup is being unwound if the stat is cached for an inode, you've to also implement calls like unlink, rmdir (which deletes files/directories) and flush the cache corresponding to the inode. Otherwise lookup will be succeeding even for unlinked files, but the actual operations (like open/chmod/chown etc) will fail.<br>
</blockquote>
<br></div>
I have added this yesterday afternoon, as well as some LOCK/UNLOCK in order to prevent concurrency problems. :)<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You should also handle calls which can change the stat of a file or directory (like write/chmod/chown). As a simple implementation you can just flush the cache.<br>
</blockquote>
<br></div>
I did override setattr and fsetattr (for flushing the cache). Is it wrong? Do I have to override write/chmod/chown either?</blockquote><div><br>You are right., chmod and chown are replaced by setattr. Sorry about that:). You need to flush the cache during write also. In general any fop that can potentially change stat should be implemented. <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
if (cache->next) {<br>
do {<br>
cache = cache->next;<br>
if (cache->ino == ino) {<br>
<br>
<br>
instead of just returning, you can choose to update the cached stat with the one passed as argument to this procedure.<br>
<br>
return 0; /* already in */<br>
}<br>
} while(cache->next);<br>
}<br>
</blockquote>
<br></div>
Thanks for suggestion.<br>
<br>
Best regards,<br>
-- <br><font color="#888888">
Olivier</font><div><div></div><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@nongnu.org" target="_blank">Gluster-devel@nongnu.org</a><br>
<a href="http://lists.nongnu.org/mailman/listinfo/gluster-devel" target="_blank">http://lists.nongnu.org/mailman/listinfo/gluster-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Raghavendra G<br><br>