The memory for 'xfs_uuid_table' is allocated in xfs_uuid_mount() but is never freed (see xfs_mount.c). Not sure where exactly it is appropriate to call kmem_free() for it. Perhaps, - in the exit-function of XFS kernel module or when the table becomes empty? Found this problem with the memory leak detector from KEDR Framework when running xfstests suite.
Firstly ,I do not know the codebase of XFS that well, however it will depend on when the table is freed if when the volumes are unmounted in that case I would free after the table is empty , but I would recommend doing in the module_exit() function for xfs due to the certainity it will sucess in not causing further issues as you then have certainty the filesystem module is no longer in use.
Freeing it when the module is unloaded should be sufficient. In normal use, unmounting a filesystem creates a hole in the table, which the next mount can fill. If you mount a lot of unique UUID filesystems without unmounting any in between, the table will grow accordingly, and unmounting won't shrink it - i.e. the table only grows as the number of concurrently mounted filesystem grows, but that doesn't seem like a particularly critical problem to fix.
Can you tell me where the module_exit is so I can use kmee_free to free it. Please tell me the file and the values send to xfs_uuid_table in order to correctly free it. Cheers Nick
Fixed in v4.4: commit af3b63822e73b66f3ca9927b46df8b873ab8c6ec Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Tue Nov 3 13:06:34 2015 +1100 xfs: don't leak uuid table on rmmod Don't leak the UUID table when the module is unloaded. (Found with kmemleak.) Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>