aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/kapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/kapi.c')
-rw-r--r--drivers/mtd/ubi/kapi.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index f3bab669f6bb..589c423fac2d 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -137,7 +137,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
137 return ERR_PTR(-EINVAL); 137 return ERR_PTR(-EINVAL);
138 138
139 if (mode != UBI_READONLY && mode != UBI_READWRITE && 139 if (mode != UBI_READONLY && mode != UBI_READWRITE &&
140 mode != UBI_EXCLUSIVE) 140 mode != UBI_EXCLUSIVE && mode != UBI_METAONLY)
141 return ERR_PTR(-EINVAL); 141 return ERR_PTR(-EINVAL);
142 142
143 /* 143 /*
@@ -182,10 +182,17 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
182 break; 182 break;
183 183
184 case UBI_EXCLUSIVE: 184 case UBI_EXCLUSIVE:
185 if (vol->exclusive || vol->writers || vol->readers) 185 if (vol->exclusive || vol->writers || vol->readers ||
186 vol->metaonly)
186 goto out_unlock; 187 goto out_unlock;
187 vol->exclusive = 1; 188 vol->exclusive = 1;
188 break; 189 break;
190
191 case UBI_METAONLY:
192 if (vol->metaonly || vol->exclusive)
193 goto out_unlock;
194 vol->metaonly = 1;
195 break;
189 } 196 }
190 get_device(&vol->dev); 197 get_device(&vol->dev);
191 vol->ref_count += 1; 198 vol->ref_count += 1;
@@ -343,6 +350,10 @@ void ubi_close_volume(struct ubi_volume_desc *desc)
343 break; 350 break;
344 case UBI_EXCLUSIVE: 351 case UBI_EXCLUSIVE:
345 vol->exclusive = 0; 352 vol->exclusive = 0;
353 break;
354 case UBI_METAONLY:
355 vol->metaonly = 0;
356 break;
346 } 357 }
347 vol->ref_count -= 1; 358 vol->ref_count -= 1;
348 spin_unlock(&ubi->volumes_lock); 359 spin_unlock(&ubi->volumes_lock);