hi Andreas,<br><br><div class="gmail_quote">On Sat, May 29, 2010 at 7:22 PM, Andreas Dilger <span dir="ltr"><<a href="mailto:andreas.dilger@oracle.com">andreas.dilger@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Yuriy, thanks for looking into this.  However, I think that the patch is not quite correct (though I haven't tested it yet). The issue is that the negation applies to each parameter individually, and not globally as you have changed it to be.<br>

<br>
That means that tests like:<br>
<br>
lfs find -mtime +1 ! -size 4<br>
<br>
Will now negate both the mtime and the size checks.  It seems that the correct thing to do is to store a per-test negation in the find params.<br></blockquote><div><br></div><div>Yes, you are right. Lets make a bug in your bugzilla and work on this patch there a bit. </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
It is probably best to submit patches directly via bugzilla so that they don't get lost.<br></blockquote><div>ok </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Please also make sure that there is an appropriate test in sanity.sh for the functionality being fixed.  There are already a number of lfs find tests, so new tests should be pit together.<br>
<br></blockquote><div>ok, got it. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Cheers, Andreas<div><div></div><div class="h5"><br></div></div></blockquote><div>Thanks! </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
<br>
On 2010-05-29, at 3:56, Yuriy Umanets <<a href="mailto:yuriy.umanets@clusterstor.com" target="_blank">yuriy.umanets@clusterstor.com</a>> wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
hi Lustre people,<br>
<br>
One of our clients has found the bug in lfs find, which we have fixed. Patch is attached. Issue is that find_value_cmp() and how it gets params are buggy. Inversion made by inverting sign is completely wrong idea. Please see the patch for details.<br>

<br>
Examples:<br>
<br>
Let's create some files and try to find them:<br>
<br>
[root@victim tests]# touch /mnt/lustre/a<br>
[root@victim tests]# touch /mnt/lustre/b<br>
[root@victim tests]# echo 1 > /mnt/lustre/c<br>
[root@victim tests]# ls -la /mnt/lustre/<br>
total 12<br>
drwxr-xr-x  2 root root 4096 May 29 12:31 .<br>
drwxr-xr-x 11 root root 4096 May  4 22:50 ..<br>
-rw-r--r--  1 root root    0 May 29 12:31 a<br>
-rw-r--r--  1 root root    0 May 29 12:31 b<br>
-rw-r--r--  1 root root    2 May 29 12:31 c<br>
<br>
As you can see, there are 2 zero length files and one 2 bytes long file.<br>
<br>
Example of how it worked before fix:<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s 0<br>
<br>
That is nothing found.<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s 2<br>
<br>
Again nothing is found.<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre ! -s 0<br>
<br>
Search for non zero length files also gives nothing.<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre ! -s 1<br>
/mnt/lustre/a<br>
/mnt/lustre/b<br>
<br>
This finds two zero files but does not find one 2 bytes long file.<br>
<br>
After the fix:<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s 0<br>
/mnt/lustre/a<br>
/mnt/lustre/b<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s 2<br>
/mnt/lustre/c<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre ! -s 0<br>
/mnt/lustre<br>
/mnt/lustre/c<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre ! -s 1<br>
/mnt/lustre<br>
/mnt/lustre/a<br>
/mnt/lustre/b<br>
/mnt/lustre/c<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s +1<br>
/mnt/lustre<br>
/mnt/lustre/c<br>
<br>
This found all with size 1 and more.<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s -1<br>
/mnt/lustre/a<br>
/mnt/lustre/b<br>
<br>
This found all smaller than 1 byte long.<br>
<br>
[root@victim tests]# ../utils/lfs find /mnt/lustre -s -0<br>
/mnt/lustre/a<br>
/mnt/lustre/b<br>
<br>
This found all that 0 or smaller :)<br>
<br>
Should I create bug in bugzilla or posting it to lustre-devel@ is ok?<br>
<br>
Thanks.<br>
-- <br>
umka<br></div></div>
<lfs-find-1.8.2.patch><br>
_______________________________________________<br>
Lustre-devel mailing list<br>
<a href="mailto:Lustre-devel@lists.lustre.org" target="_blank">Lustre-devel@lists.lustre.org</a><br>
<a href="http://lists.lustre.org/mailman/listinfo/lustre-devel" target="_blank">http://lists.lustre.org/mailman/listinfo/lustre-devel</a><br>
</blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>umka<br>