You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a classic "Do not reorder while traversing a list" bug from the nffs_hash in nffs_gc().
In the while-loop to traverse nffs_hash list in nffs_gc(), we call nffs_gc_inode_blocks(). But nffs_gc_inode_blocks() reorders the given list when GC. If the reorder puts the current node back to previous, then call nffs_gc_inode_blocks() again, it will inf loop.
That is, say we have a list of A->B->C->D. while we are at C, we call nffs_gc_inode_blocks(). The function can reorder the list to A->C->B->D. Now we process B, and call nffs_gc_inode_blocks(). This time the function reorder the list back to to A->B->C->D. The next node is C again. C call the func, and get A->C->B->D. The next is B. Call the func. Get A->B->C->D. Then next is C. And B, and C, B, C, B, C, B, C.... Inf loop.
The text was updated successfully, but these errors were encountered:
This is a classic "Do not reorder while traversing a list" bug from the
nffs_hash
innffs_gc()
.In the while-loop to traverse
nffs_hash
list innffs_gc()
, we callnffs_gc_inode_blocks()
. Butnffs_gc_inode_blocks()
reorders the given list when GC. If the reorder puts the current node back to previous, then call nffs_gc_inode_blocks() again, it will inf loop.That is, say we have a list of A->B->C->D. while we are at C, we call nffs_gc_inode_blocks(). The function can reorder the list to A->C->B->D. Now we process B, and call nffs_gc_inode_blocks(). This time the function reorder the list back to to A->B->C->D. The next node is C again. C call the func, and get A->C->B->D. The next is B. Call the func. Get A->B->C->D. Then next is C. And B, and C, B, C, B, C, B, C.... Inf loop.
The text was updated successfully, but these errors were encountered: