aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/block.c2
-rw-r--r--drivers/mtd/ubi/build.c11
-rw-r--r--drivers/mtd/ubi/fastmap-wl.c1
-rw-r--r--fs/ubifs/find.c2
-rw-r--r--fs/ubifs/lprops.c4
-rw-r--r--fs/ubifs/scan.c1
-rw-r--r--fs/ubifs/super.c14
7 files changed, 24 insertions, 11 deletions
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index b1fc28f63882..d0b63bbf46a7 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
244 * in any case. 244 * in any case.
245 */ 245 */
246 if (mode & FMODE_WRITE) { 246 if (mode & FMODE_WRITE) {
247 ret = -EPERM; 247 ret = -EROFS;
248 goto out_unlock; 248 goto out_unlock;
249 } 249 }
250 250
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index e941395de3ae..753494e042d5 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -854,6 +854,17 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
854 return -EINVAL; 854 return -EINVAL;
855 } 855 }
856 856
857 /*
858 * Both UBI and UBIFS have been designed for SLC NAND and NOR flashes.
859 * MLC NAND is different and needs special care, otherwise UBI or UBIFS
860 * will die soon and you will lose all your data.
861 */
862 if (mtd->type == MTD_MLCNANDFLASH) {
863 pr_err("ubi: refuse attaching mtd%d - MLC NAND is not supported\n",
864 mtd->index);
865 return -EINVAL;
866 }
867
857 if (ubi_num == UBI_DEV_NUM_AUTO) { 868 if (ubi_num == UBI_DEV_NUM_AUTO) {
858 /* Search for an empty slot in the @ubi_devices array */ 869 /* Search for an empty slot in the @ubi_devices array */
859 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) 870 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
index 590d967011bb..98f7d6be8d1f 100644
--- a/drivers/mtd/ubi/fastmap-wl.c
+++ b/drivers/mtd/ubi/fastmap-wl.c
@@ -362,7 +362,6 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
362{ 362{
363 int i; 363 int i;
364 364
365 flush_work(&ubi->fm_work);
366 return_unused_pool_pebs(ubi, &ubi->fm_pool); 365 return_unused_pool_pebs(ubi, &ubi->fm_pool);
367 return_unused_pool_pebs(ubi, &ubi->fm_wl_pool); 366 return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
368 367
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 2dcf3d473fec..9571616b5dda 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -632,7 +632,7 @@ static int scan_for_idx_cb(struct ubifs_info *c,
632 */ 632 */
633static const struct ubifs_lprops *scan_for_leb_for_idx(struct ubifs_info *c) 633static const struct ubifs_lprops *scan_for_leb_for_idx(struct ubifs_info *c)
634{ 634{
635 struct ubifs_lprops *lprops; 635 const struct ubifs_lprops *lprops;
636 struct scan_data data; 636 struct scan_data data;
637 int err; 637 int err;
638 638
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index 6c3a1abd0e22..f5a46844340c 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -244,7 +244,6 @@ static void remove_from_lpt_heap(struct ubifs_info *c,
244/** 244/**
245 * lpt_heap_replace - replace lprops in a category heap. 245 * lpt_heap_replace - replace lprops in a category heap.
246 * @c: UBIFS file-system description object 246 * @c: UBIFS file-system description object
247 * @old_lprops: LEB properties to replace
248 * @new_lprops: LEB properties with which to replace 247 * @new_lprops: LEB properties with which to replace
249 * @cat: LEB category 248 * @cat: LEB category
250 * 249 *
@@ -254,7 +253,6 @@ static void remove_from_lpt_heap(struct ubifs_info *c,
254 * lprops. This function does that. 253 * lprops. This function does that.
255 */ 254 */
256static void lpt_heap_replace(struct ubifs_info *c, 255static void lpt_heap_replace(struct ubifs_info *c,
257 struct ubifs_lprops *old_lprops,
258 struct ubifs_lprops *new_lprops, int cat) 256 struct ubifs_lprops *new_lprops, int cat)
259{ 257{
260 struct ubifs_lpt_heap *heap; 258 struct ubifs_lpt_heap *heap;
@@ -362,7 +360,7 @@ void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops,
362 case LPROPS_DIRTY: 360 case LPROPS_DIRTY:
363 case LPROPS_DIRTY_IDX: 361 case LPROPS_DIRTY_IDX:
364 case LPROPS_FREE: 362 case LPROPS_FREE:
365 lpt_heap_replace(c, old_lprops, new_lprops, cat); 363 lpt_heap_replace(c, new_lprops, cat);
366 break; 364 break;
367 case LPROPS_UNCAT: 365 case LPROPS_UNCAT:
368 case LPROPS_EMPTY: 366 case LPROPS_EMPTY:
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index aab87340d3de..16f03d9929e5 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -175,7 +175,6 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
175void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb, 175void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
176 int lnum, int offs) 176 int lnum, int offs)
177{ 177{
178 lnum = lnum;
179 dbg_scan("stop scanning LEB %d at offset %d", lnum, offs); 178 dbg_scan("stop scanning LEB %d at offset %d", lnum, offs);
180 ubifs_assert(offs % c->min_io_size == 0); 179 ubifs_assert(offs % c->min_io_size == 0);
181 180
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b16ef162344a..6c397a389105 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1737,8 +1737,11 @@ static void ubifs_remount_ro(struct ubifs_info *c)
1737 1737
1738 dbg_save_space_info(c); 1738 dbg_save_space_info(c);
1739 1739
1740 for (i = 0; i < c->jhead_cnt; i++) 1740 for (i = 0; i < c->jhead_cnt; i++) {
1741 ubifs_wbuf_sync(&c->jheads[i].wbuf); 1741 err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
1742 if (err)
1743 ubifs_ro_mode(c, err);
1744 }
1742 1745
1743 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); 1746 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
1744 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); 1747 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
@@ -1804,8 +1807,11 @@ static void ubifs_put_super(struct super_block *sb)
1804 int err; 1807 int err;
1805 1808
1806 /* Synchronize write-buffers */ 1809 /* Synchronize write-buffers */
1807 for (i = 0; i < c->jhead_cnt; i++) 1810 for (i = 0; i < c->jhead_cnt; i++) {
1808 ubifs_wbuf_sync(&c->jheads[i].wbuf); 1811 err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
1812 if (err)
1813 ubifs_ro_mode(c, err);
1814 }
1809 1815
1810 /* 1816 /*
1811 * We are being cleanly unmounted which means the 1817 * We are being cleanly unmounted which means the