Whamcloud - gitweb
LU-16427 lfs: rmfid does not print anything on error 88/50388/11
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Mon, 3 Apr 2023 21:48:15 +0000 (03:18 +0530)
committerOleg Drokin <green@whamcloud.com>
Mon, 1 May 2023 04:09:34 +0000 (04:09 +0000)
commit5d930252407cc11604c4b9de2984784c62c43a4c
treebe0aa9c146034ebd9f9118a078d97a3673e7e8ac
parentd7de5d6e1bac3555d89aef224030ef6f07c5b14d
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>
lustre/doc/Makefile.am
lustre/doc/llapi_rmfid.3
lustre/doc/llapi_rmfid_at.3 [new file with mode: 0644]
lustre/doc/llapi_root_path_open.3 [new file with mode: 0644]
lustre/doc/lustreapi.7
lustre/include/lustre/lustreapi.h
lustre/utils/lfs.c
lustre/utils/liblustreapi_util.c