You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/09/10 07:33:19 UTC

[GitHub] [mynewt-nffs] yashi opened a new issue #19: Infinite loop in nffs_gc()

yashi opened a new issue #19: Infinite loop in nffs_gc()
URL: https://github.com/apache/mynewt-nffs/issues/19
 
 
   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.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services