From f015bfa1c2499f97b8bf30d913f77532e176c023 Mon Sep 17 00:00:00 2001 From: Surbhi Palande Date: Wed, 29 Sep 2010 15:15:02 +0300 Subject: [PATCH 13/19] Add locks for Manage_runstop() Before deleting an entry from the maps file, lock the file and use the most updated copy. Signed-off-by: Surbhi Palande --- Manage.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Manage.c b/Manage.c index 12e24dd..9005e05 100644 --- a/Manage.c +++ b/Manage.c @@ -125,9 +125,11 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet) devnum = minor(stb.st_rdev); else devnum = -1-(minor(stb.st_rdev)>>6); + map_lock(&map); map_delete(&map, devnum); map_write(map); map_free(map); + map_unlock(&map); } } return 0; -- 1.7.0.4