diff options
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 3410ea8109f8..f5c715c32dcd 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -61,13 +61,13 @@ static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc) | |||
61 | struct ubi_volume *vol = desc->vol; | 61 | struct ubi_volume *vol = desc->vol; |
62 | 62 | ||
63 | spin_lock(&vol->ubi->volumes_lock); | 63 | spin_lock(&vol->ubi->volumes_lock); |
64 | users = vol->readers + vol->writers + vol->exclusive; | 64 | users = vol->readers + vol->writers + vol->exclusive + vol->metaonly; |
65 | ubi_assert(users > 0); | 65 | ubi_assert(users > 0); |
66 | if (users > 1) { | 66 | if (users > 1) { |
67 | ubi_err(ubi, "%d users for volume %d", users, vol->vol_id); | 67 | ubi_err(ubi, "%d users for volume %d", users, vol->vol_id); |
68 | err = -EBUSY; | 68 | err = -EBUSY; |
69 | } else { | 69 | } else { |
70 | vol->readers = vol->writers = 0; | 70 | vol->readers = vol->writers = vol->metaonly = 0; |
71 | vol->exclusive = 1; | 71 | vol->exclusive = 1; |
72 | err = desc->mode; | 72 | err = desc->mode; |
73 | desc->mode = UBI_EXCLUSIVE; | 73 | desc->mode = UBI_EXCLUSIVE; |
@@ -87,13 +87,15 @@ static void revoke_exclusive(struct ubi_volume_desc *desc, int mode) | |||
87 | struct ubi_volume *vol = desc->vol; | 87 | struct ubi_volume *vol = desc->vol; |
88 | 88 | ||
89 | spin_lock(&vol->ubi->volumes_lock); | 89 | spin_lock(&vol->ubi->volumes_lock); |
90 | ubi_assert(vol->readers == 0 && vol->writers == 0); | 90 | ubi_assert(vol->readers == 0 && vol->writers == 0 && vol->metaonly == 0); |
91 | ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); | 91 | ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); |
92 | vol->exclusive = 0; | 92 | vol->exclusive = 0; |
93 | if (mode == UBI_READONLY) | 93 | if (mode == UBI_READONLY) |
94 | vol->readers = 1; | 94 | vol->readers = 1; |
95 | else if (mode == UBI_READWRITE) | 95 | else if (mode == UBI_READWRITE) |
96 | vol->writers = 1; | 96 | vol->writers = 1; |
97 | else if (mode == UBI_METAONLY) | ||
98 | vol->metaonly = 1; | ||
97 | else | 99 | else |
98 | vol->exclusive = 1; | 100 | vol->exclusive = 1; |
99 | spin_unlock(&vol->ubi->volumes_lock); | 101 | spin_unlock(&vol->ubi->volumes_lock); |