cxl-micron-reskit / famfs

This is the user space repo for famfs, the fabric-attached memory file system
Apache License 2.0
31 stars 9 forks source link

famfs check: fixed a issue with the 'famfs check' command #57

Closed leeq2016 closed 3 months ago

leeq2016 commented 3 months ago

Assume '/mnt/famfs' is a FAMFS dir.

The command 'famfs check -v /mnt/famfs' is run ok, but 'famfs check -v /mnt/famfs/' with some problem.

This is because in strcmp(path, xmpt), 'path' is not processed by realpath.

leeq2016 commented 3 months ago

Log:

[root@famfs2 famfs]# famfs check -v /mnt/famfs/ famfs_check: path (/mnt/famfs/) is not a famfs mount point [root@famfs2 famfs]# famfs check -v /mnt/famfs famfs_recursive_check: /mnt/famfs/for_test_4G famfs_recursive_check: /mnt/famfs/test_1 famfs_recursive_check: /mnt/famfs/test famfs_recursive_check: /mnt/famfs/.meta famfs_recursive_check: /mnt/famfs/.meta/.log famfs_recursive_check: /mnt/famfs/.meta/.superblock famfs_check: 5 files, 1 directories, 0 errors

jagalactic commented 3 months ago

Thanks for the fix!

Smoke tests under valgrind showed this introduced a memory leak (which happened in multiple tests):

==40275== Memcheck, a memory error detector ==40275== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==40275== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info ==40275== Command: /home/jmg/w/famfs/debug/famfs check -v /mnt/famfs ==40275== ==40275== ==40275== HEAP SUMMARY: ==40275== in use at exit: 11 bytes in 1 blocks ==40275== total heap usage: 13 allocs, 12 frees, 199,798 bytes allocated ==40275== ==40275== 11 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==40275== at 0x484282F: malloc (vg_replace_malloc.c:446) ==40275== by 0x493B05E: strdup (in /usr/lib64/libc.so.6) ==40275== by 0x48CFD64: realpath@@GLIBC_2.3 (in /usr/lib64/libc.so.6) ==40275== by 0x40789E: famfs_path_is_mount_pt (famfs_lib.c:863) ==40275== by 0x40DCD4: famfs_check (famfs_lib.c:3998) ==40275== by 0x40378A: do_famfs_cli_check (famfs_cli.c:682) ==40275== by 0x405656: main (famfs_cli.c:1697) ==40275== ==40275== LEAK SUMMARY: ==40275== definitely lost: 11 bytes in 1 blocks ==40275== indirectly lost: 0 bytes in 0 blocks ==40275== possibly lost: 0 bytes in 0 blocks ==40275== still reachable: 0 bytes in 0 blocks ==40275== suppressed: 0 bytes in 0 blocks ==40275== ==40275== For lists of detected and suppressed errors, rerun with: -s ==40275== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

I will push the fix shortly after merging this PR

John