Whamcloud - gitweb
LU-16427 lfs: rmfid does not print anything on error
This patch:
01. Improve rmfid
Adds llapi_root_path_open() This function accepts the device
or path and returns the open fd for them. This was done so
that it is called only _once_ and not at every lookup.
Adds llapi_rmfid_at() This function makes the final IOCTL to
rmfid. Since llapi_root_path_open() we already had the valid
fd and populated 'fid_structure'. We could isolate this and
not call the former llapi_rmfid()
02. Fix rmfid silently accepting fid without fsname
or lustre root mount point. Make it correctly
fail if required arguments is not provided.
After Patch:
~~~~~~~~~~~~
$ lfs rmfid 0x200000402:0x1:0x0
lfs rmfid: missing <fsname|rootpath> or <fid>
Remove file(s) by FID(s)
usage: rmfid <fsname|rootpath> <fid> ...
Before Patch:
~~~~~~~~~~~~
$ lfs rmfid 0x200000402:0x1:0x0
$
03. Fix rmfid memory leak
After Patch:
~~~~~~~~~~~~
$ valgrind --leak-check=full lfs rmfid lustre 0x200000402:0x1:0x0
==33793== HEAP SUMMARY:
==33793== in use at exit: 0 bytes in 0 blocks
==33793== total heap usage: 4 allocs, 4 frees, 1,567 bytes allocated
==33793==
==33793== All heap blocks were freed -- no leaks are possible
Before Patch:
~~~~~~~~~~~~
$ valgrind --leak-check=full lfs rmfid lustre 0x200000402:0x1:0x0
==30812== LEAK SUMMARY:
==30812== definitely lost: 48 bytes in 1 blocks
==30812== indirectly lost: 0 bytes in 0 blocks
==30812== possibly lost: 0 bytes in 0 blocks
==30812== still reachable: 0 bytes in 0 blocks
==30812== suppressed: 0 bytes in 0 blocks
04. Update/Add Man pages
Update llapi_rmfid.3 and lustreapi.7 man pages
Add new llapi_rmfid_at.3 and llapi_root_path_open.3 man pages
Test-Parameters: trivial testlist=sanity
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Idda9313c97e48e9f7bf6486894b6ae3c74d71981
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50388
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Thomas Bertschinger <bertschinger@lanl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>