From: Yuriy M. Kaminskiy Date: Thu, 7 Apr 2016 21:38:56 +0000 (+0300) Subject: fsck: fix racing between unlock/unlink and open X-Git-Tag: v2.29-rc1~278 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc75981a229a52ee8f5245c4a036dd151e4a70fc;p=thirdparty%2Futil-linux.git fsck: fix racing between unlock/unlink and open Process A Process B Process C open() [creates file] lock() [succeed] open() [open existing] lock()... running() close() [...succeed] unlink() running() open() [creates file] {BAD!} lock() [succeed] {BAD!} running() {BAD!} close() Cons: leaves empty (unlocked/harmless) .lock files in /run/fsck/ Signed-off-by: Yuriy M. Kaminskiy --- diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c index 05cfbc4390..84d2dcc3d4 100644 --- a/disk-utils/fsck.c +++ b/disk-utils/fsck.c @@ -410,7 +410,6 @@ static void unlock_disk(struct fsck_instance *inst) printf(_("Unlocking %s.\n"), inst->lockpath); close(inst->lock); /* unlock */ - unlink(inst->lockpath); free(inst->lockpath);