erofs-utils: mkfs: fix an indefinite wait race
authorGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 21 Aug 2024 03:43:26 +0000 (11:43 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 21 Aug 2024 03:47:18 +0000 (11:47 +0800)
commit93c46f53ece7fa5a6fc84df20c9a00b813c31edf
tree907b022c9555db5bb9ea37aafac6a4a0c28306e2
parent74eecf77f5b2e3033362ae5c2fc13895dbbf76f7
erofs-utils: mkfs: fix an indefinite wait race

Coverity reports: In erofs_mkfs_flushjobs, a thread waits for
a thread-shared condition that may have already been satisfied,
causing a hang.

It might indeed happen if the dfops worker runs with the specific
timing.  Let's try to fix it and see if the report is cleared.

Coverity-id: 502330
Fixes: 37e5abcd8720 ("erofs-utils: mkfs: assign root NID in the main thread")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240821034326.2464146-1-hsiangkao@linux.alibaba.com
lib/inode.c