From 783b273afab43437dca731a229d53d72faf77fd3 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 25 Dec 2007 18:13:33 +0200 Subject: UBI: use separate mutex for volumes checking Introduce a separate mutex which serializes volumes checking, because we cammot really use volumes_mutex - it cases reverse locking problems with mtd_tbl_mutex when gluebi is used - thanks to lockdep. Signed-off-by: Artem Bityutskiy --- drivers/mtd/ubi/kapi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'drivers/mtd/ubi/kapi.c') diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 4ec3a33b2577..146957c3380d 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -169,17 +169,12 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode) desc->vol = vol; desc->mode = mode; - /* - * To prevent simultaneous checks of the same volume we use - * @volumes_mutex, although it is not the purpose it was introduced - * for. - */ - mutex_lock(&ubi->volumes_mutex); + mutex_lock(&ubi->ckvol_mutex); if (!vol->checked) { /* This is the first open - check the volume */ err = ubi_check_volume(ubi, vol_id); if (err < 0) { - mutex_unlock(&ubi->volumes_mutex); + mutex_unlock(&ubi->ckvol_mutex); ubi_close_volume(desc); return ERR_PTR(err); } @@ -190,7 +185,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode) } vol->checked = 1; } - mutex_unlock(&ubi->volumes_mutex); + mutex_unlock(&ubi->ckvol_mutex); return desc; -- cgit v1.2.3