aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/kapi.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-25 11:13:33 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:17 -0500
commit783b273afab43437dca731a229d53d72faf77fd3 (patch)
treedaadf822539189bcc81d64a609f2b084849114e5 /drivers/mtd/ubi/kapi.c
parent897a316c9e6f7fea6f1d3759797b75c0ebaec479 (diff)
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 <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/kapi.c')
-rw-r--r--drivers/mtd/ubi/kapi.c11
1 files changed, 3 insertions, 8 deletions
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)
169 desc->vol = vol; 169 desc->vol = vol;
170 desc->mode = mode; 170 desc->mode = mode;
171 171
172 /* 172 mutex_lock(&ubi->ckvol_mutex);
173 * To prevent simultaneous checks of the same volume we use
174 * @volumes_mutex, although it is not the purpose it was introduced
175 * for.
176 */
177 mutex_lock(&ubi->volumes_mutex);
178 if (!vol->checked) { 173 if (!vol->checked) {
179 /* This is the first open - check the volume */ 174 /* This is the first open - check the volume */
180 err = ubi_check_volume(ubi, vol_id); 175 err = ubi_check_volume(ubi, vol_id);
181 if (err < 0) { 176 if (err < 0) {
182 mutex_unlock(&ubi->volumes_mutex); 177 mutex_unlock(&ubi->ckvol_mutex);
183 ubi_close_volume(desc); 178 ubi_close_volume(desc);
184 return ERR_PTR(err); 179 return ERR_PTR(err);
185 } 180 }
@@ -190,7 +185,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
190 } 185 }
191 vol->checked = 1; 186 vol->checked = 1;
192 } 187 }
193 mutex_unlock(&ubi->volumes_mutex); 188 mutex_unlock(&ubi->ckvol_mutex);
194 189
195 return desc; 190 return desc;
196 191