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