Daniel, prev_chunk->dirents is an empty list. The num_entries say 112, but the next and prev suggest an empty list. I did not find any code that decrements num_entries as dirents are removed. Only a reset back to zero if the whole list is emptied. 1. Should the code below check for empty list? If empty go backwards to the prev_chunk’s prev or just set reload_ck to whence 2. Does the code in unchunk_dirent that removes from chunk also need to decrement num_entries 3. Will not decrementing the num_entries have an effect on the split logic in place_new_dirent – or at least that code need to handle empty chunks 4. Do empty chunks get cleaned up? ***** Code snippet for 1 and core: mdcache_get_chunk. **** if (prev_chunk) { chunk->reload_ck = glist_last_entry(&prev_chunk->dirents, mdcache_dir_entry_t,
Line 914 chunk_list)->ck; /* unref prev_chunk as we had got a ref on prev_chunk * at the beginning of this function */ mdcache_lru_unref_chunk(prev_chunk); } else { chunk->reload_ck = whence; }
Note: This core had a ref_count of 1 for the prev_chunk. A different core had a ref_count of 1 for prev_chunk ******* core ***** (gdb) info locals lru = 0x0 chunk = 0x75320370 __func__ = "mdcache_get_chunk" (gdb) info args parent = 0x2f837f60 prev_chunk = 0x2f70dc50 whence = 18525227 (gdb) print *chunk $2 = {chunks = {next = 0x2f838200, prev = 0x40ab5700}, dirents = {next = 0x75320380, prev = 0x75320380}, parent = 0x2f837f60, chunk_lru = {q = {next = 0x0, prev = 0x0}, qid = LRU_ENTRY_NONE, refcnt = 0, flags = 0, lane = 0, cf = 0}, reload_ck = 0, next_ck = 0, num_entries = 0} (gdb) print *prev_chunk $3 = {chunks = {next = 0x39a24aa0, prev = 0x55ed7f00}, dirents = {next = 0x2f70dc60, prev = 0x2f70dc60}, parent = 0x0, chunk_lru = {q = {next = 0x0, prev = 0x0}, qid = LRU_ENTRY_L1, refcnt = 1, flags = 0, lane = 0, cf = 0}, reload_ck = 0, next_ck = 0, num_entries = 112} (gdb) bt #0 mdcache_get_chunk (parent=0x2f837f60, prev_chunk=0x2f70dc50, whence=18525227) at /src/src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.c:914 #1 0x0000000000541da9 in mdcache_populate_dir_chunk (directory=0x2f837f60, whence=18525227, dirent=0x7f0edeea3940, prev_chunk=0x2f70dc50, eod_met=0x7f0edeea393f) at /src/src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_helpers.c:2554 #2 0x00000000005437cd in mdcache_readdir_chunked (directory=0x2f837f60, whence=18525227, dir_state=0x7f0edeea3af0, cb=0x4325fd <populate_dirent>, attrmask=0, eod_met=0x7f0edeea3feb) at /src/src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_helpers.c:2985 #3 0x0000000000531b60 in mdcache_readdir (dir_hdl=0x2f837f98, whence=0x7f0edeea3ad0, dir_state=0x7f0edeea3af0, cb=0x4325fd <populate_dirent>, attrmask=0, eod_met=0x7f0edeea3feb) at /src/src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_handle.c:559 #4 0x0000000000432f24 in fsal_readdir (directory=0x2f837f98, cookie=18525227, nbfound=0x7f0edeea3fec, eod_met=0x7f0edeea3feb, attrmask=0, cb=0x491f59 <nfs3_readdir_callback>, opaque=0x7f0edeea3fa0) at /src/src/FSAL/fsal_helper.c:1164 #5 0x0000000000491d41 in nfs3_readdir (arg=0x7534a418, req=0x75349d10, res=0x75289cf0) at /src/src/Protocols/NFS/nfs3_readdir.c:289 #6 0x0000000000457e26 in nfs_rpc_process_request (reqdata=0x75349d10) at /src/src/MainNFSD/nfs_worker_thread.c:1328 #7 0x00000000004585e5 in nfs_rpc_valid_NFS (req=0x75349d10) at /src/src/MainNFSD/nfs_worker_thread.c:1548 #8 0x00007f0ee83c4034 in svc_vc_decode (req=0x75349d10) at /src/src/libntirpc/src/svc_vc.c:829 #9 0x000000000044afd5 in nfs_rpc_decode_request (xprt=0x1453b20, xdrs=0x75363020) at /src/src/MainNFSD/nfs_rpc_dispatcher_thread.c:1345 #10 0x00007f0ee83c3f45 in svc_vc_recv (xprt=0x1453b20) at /src/src/libntirpc/src/svc_vc.c:802 #11 0x00007f0ee83c0689 in svc_rqst_xprt_task (wpe=0x1453d38) at /src/src/libntirpc/src/svc_rqst.c:769 #12 0x00007f0ee83c0ae6 in svc_rqst_epoll_events (sr_rec=0x1434020, n_events=1) at /src/src/libntirpc/src/svc_rqst.c:941 #13 0x00007f0ee83c0d7b in svc_rqst_epoll_loop (sr_rec=0x1434020) at /src/src/libntirpc/src/svc_rqst.c:1014 #14 0x00007f0ee83c0e2e in svc_rqst_run_task (wpe=0x1434020) at /src/src/libntirpc/src/svc_rqst.c:1050 #15 0x00007f0ee83c97f6 in work_pool_thread (arg=0x144d470) at /src/src/libntirpc/src/work_pool.c:181 #16 0x00007f0ee73e7de5 in start_thread () from /lib64/libpthread.so.0 #17 0x00007f0ee6ceef1d in clone () from /lib64/libc.so.6