]> Zhao Yanbai Git Server - minix.git/commitdiff
libminixfs: fix assert
authorBen Gras <ben@minix3.org>
Wed, 21 May 2014 17:32:39 +0000 (19:32 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:41 +0000 (17:05 +0200)
Came across this bug.

 . setcache assert should be when block currently isn't in use,
   as setcache happens when buf becomes unused

lib/libminixfs/cache.c

index f503f8cc3ba6ac139e568ded1e42be1bdfa69cfd..3f7a2c5da27d1732b3faac170c55de1d6c36ac99 100644 (file)
@@ -297,10 +297,10 @@ struct buf *lmfs_get_block_ino(dev_t dev, block_t block, int only_search,
                        bp->data = NULL;
                        break;
                }
-               ASSERT(bp->lmfs_needsetcache == 0);
                /* Block needed has been found. */
                if (bp->lmfs_count == 0) {
                        rm_lru(bp);
+                       ASSERT(bp->lmfs_needsetcache == 0);
                        ASSERT(!(bp->lmfs_flags & VMMC_BLOCK_LOCKED));
                        bp->lmfs_flags |= VMMC_BLOCK_LOCKED;
                }