--- x/fs/jfs/jfs_logmgr.c +++ y/fs/jfs/jfs_logmgr.c @@ -149,6 +149,7 @@ do { \ * of log page */ #define lbmDIRECT 0x0100 +#define lbmInflight 0x0200 /* * Global list of active external journals @@ -1861,6 +1862,8 @@ static void lbmLogShutdown(struct jfs_lo while (lbuf) { struct lbuf *next = lbuf->l_freelist; __free_page(lbuf->l_page); + while (lbuf->l_flag & lbmInflight) + schedule_timeout_idle(HZ); kfree(lbuf); lbuf = next; } @@ -2130,6 +2133,7 @@ static void lbmStartIO(struct lbuf * bp) bio->bi_iter.bi_size = 0; lbmIODone(bio); } else { + bp->l_flag |= lbmInflight; submit_bio(bio); INCREMENT(lmStat.submitted); } @@ -2226,6 +2230,7 @@ static void lbmIODone(struct bio *bio) if (bp->l_flag & lbmDIRECT) { LCACHE_WAKEUP(&bp->l_ioevent); LCACHE_UNLOCK(flags); + bp->l_flag &= ~lbmInflight; return; } @@ -2305,6 +2310,7 @@ static void lbmIODone(struct bio *bio) LCACHE_UNLOCK(flags); /* unlock+enable */ } + bp->l_flag &= ~lbmInflight; } int jfsIOWait(void *arg)