aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-13 19:42:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-13 19:42:11 -0400
commit89838b80bbbf9774cf010905851db7913c9331f0 (patch)
tree4d47f408fc90c2f575f5741093fdf34dc9f74b1e
parentf6f993328b2abcab86a3c99d7bd9f2066ab03d36 (diff)
parent25601a3c9737fed554169759582c690b98ead5d4 (diff)
Merge tag 'upstream-3.17-rc1' of git://git.infradead.org/linux-ubifs
Pull UBI/UBIFS changes from Artem Bityutskiy: "No significant changes, mostly small fixes here and there. The more important fixes are: - UBI deleted list items while iterating the list with 'list_for_each_entry' - The UBI block driver did not work properly with very large UBI volumes" * tag 'upstream-3.17-rc1' of git://git.infradead.org/linux-ubifs: (21 commits) UBIFS: Add log overlap assertions Revert "UBIFS: add a log overlap assertion" UBI: bugfix in ubi_wl_flush() UBI: block: Avoid disk size integer overflow UBI: block: Set disk_capacity out of the mutex UBI: block: Make ubiblock_resize return something UBIFS: add a log overlap assertion UBIFS: remove unnecessary check UBIFS: remove mst_mutex UBIFS: kernel-doc warning fix UBI: init_volumes: Ignore volumes with no LEBs UBIFS: replace seq_printf by seq_puts UBIFS: replace count*size kzalloc by kcalloc UBIFS: kernel-doc warning fix UBIFS: fix error path in create_default_filesystem() UBIFS: fix spelling of "scanned" UBIFS: fix some comments UBIFS: remove useless @ecc in struct ubifs_scan_leb UBIFS: remove useless statements UBIFS: Add missing break statements in dbg_chk_pnode() ...
-rw-r--r--drivers/mtd/ubi/block.c18
-rw-r--r--drivers/mtd/ubi/vtbl.c2
-rw-r--r--drivers/mtd/ubi/wl.c4
-rw-r--r--fs/ubifs/commit.c2
-rw-r--r--fs/ubifs/io.c2
-rw-r--r--fs/ubifs/log.c12
-rw-r--r--fs/ubifs/lpt.c5
-rw-r--r--fs/ubifs/lpt_commit.c7
-rw-r--r--fs/ubifs/master.c7
-rw-r--r--fs/ubifs/orphan.c1
-rw-r--r--fs/ubifs/recovery.c5
-rw-r--r--fs/ubifs/sb.c4
-rw-r--r--fs/ubifs/scan.c14
-rw-r--r--fs/ubifs/super.c19
-rw-r--r--fs/ubifs/tnc.c1
-rw-r--r--fs/ubifs/tnc_commit.c1
-rw-r--r--fs/ubifs/ubifs.h4
17 files changed, 53 insertions, 55 deletions
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 8457df7ec5af..33c64955d4d7 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -378,9 +378,11 @@ int ubiblock_create(struct ubi_volume_info *vi)
378{ 378{
379 struct ubiblock *dev; 379 struct ubiblock *dev;
380 struct gendisk *gd; 380 struct gendisk *gd;
381 int disk_capacity; 381 u64 disk_capacity = ((u64)vi->size * vi->usable_leb_size) >> 9;
382 int ret; 382 int ret;
383 383
384 if ((sector_t)disk_capacity != disk_capacity)
385 return -EFBIG;
384 /* Check that the volume isn't already handled */ 386 /* Check that the volume isn't already handled */
385 mutex_lock(&devices_mutex); 387 mutex_lock(&devices_mutex);
386 if (find_dev_nolock(vi->ubi_num, vi->vol_id)) { 388 if (find_dev_nolock(vi->ubi_num, vi->vol_id)) {
@@ -412,7 +414,6 @@ int ubiblock_create(struct ubi_volume_info *vi)
412 gd->first_minor = dev->ubi_num * UBI_MAX_VOLUMES + dev->vol_id; 414 gd->first_minor = dev->ubi_num * UBI_MAX_VOLUMES + dev->vol_id;
413 gd->private_data = dev; 415 gd->private_data = dev;
414 sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); 416 sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
415 disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
416 set_capacity(gd, disk_capacity); 417 set_capacity(gd, disk_capacity);
417 dev->gd = gd; 418 dev->gd = gd;
418 419
@@ -498,11 +499,16 @@ int ubiblock_remove(struct ubi_volume_info *vi)
498 return 0; 499 return 0;
499} 500}
500 501
501static void ubiblock_resize(struct ubi_volume_info *vi) 502static int ubiblock_resize(struct ubi_volume_info *vi)
502{ 503{
503 struct ubiblock *dev; 504 struct ubiblock *dev;
504 int disk_capacity; 505 u64 disk_capacity = ((u64)vi->size * vi->usable_leb_size) >> 9;
505 506
507 if ((sector_t)disk_capacity != disk_capacity) {
508 ubi_warn("%s: the volume is too big, cannot resize (%d LEBs)",
509 dev->gd->disk_name, vi->size);
510 return -EFBIG;
511 }
506 /* 512 /*
507 * Need to lock the device list until we stop using the device, 513 * Need to lock the device list until we stop using the device,
508 * otherwise the device struct might get released in 514 * otherwise the device struct might get released in
@@ -512,15 +518,15 @@ static void ubiblock_resize(struct ubi_volume_info *vi)
512 dev = find_dev_nolock(vi->ubi_num, vi->vol_id); 518 dev = find_dev_nolock(vi->ubi_num, vi->vol_id);
513 if (!dev) { 519 if (!dev) {
514 mutex_unlock(&devices_mutex); 520 mutex_unlock(&devices_mutex);
515 return; 521 return -ENODEV;
516 } 522 }
517 523
518 mutex_lock(&dev->dev_mutex); 524 mutex_lock(&dev->dev_mutex);
519 disk_capacity = (vi->size * vi->usable_leb_size) >> 9;
520 set_capacity(dev->gd, disk_capacity); 525 set_capacity(dev->gd, disk_capacity);
521 ubi_msg("%s resized to %d LEBs", dev->gd->disk_name, vi->size); 526 ubi_msg("%s resized to %d LEBs", dev->gd->disk_name, vi->size);
522 mutex_unlock(&dev->dev_mutex); 527 mutex_unlock(&dev->dev_mutex);
523 mutex_unlock(&devices_mutex); 528 mutex_unlock(&devices_mutex);
529 return 0;
524} 530}
525 531
526static int ubiblock_notify(struct notifier_block *nb, 532static int ubiblock_notify(struct notifier_block *nb,
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index d77b1c1d7c72..07cac5f9ffb8 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -591,7 +591,7 @@ static int init_volumes(struct ubi_device *ubi,
591 591
592 /* Static volumes only */ 592 /* Static volumes only */
593 av = ubi_find_av(ai, i); 593 av = ubi_find_av(ai, i);
594 if (!av) { 594 if (!av || !av->leb_count) {
595 /* 595 /*
596 * No eraseblocks belonging to this volume found. We 596 * No eraseblocks belonging to this volume found. We
597 * don't actually know whether this static volume is 597 * don't actually know whether this static volume is
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 0f3425dac910..20f491713145 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1718,12 +1718,12 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
1718 vol_id, lnum, ubi->works_count); 1718 vol_id, lnum, ubi->works_count);
1719 1719
1720 while (found) { 1720 while (found) {
1721 struct ubi_work *wrk; 1721 struct ubi_work *wrk, *tmp;
1722 found = 0; 1722 found = 0;
1723 1723
1724 down_read(&ubi->work_sem); 1724 down_read(&ubi->work_sem);
1725 spin_lock(&ubi->wl_lock); 1725 spin_lock(&ubi->wl_lock);
1726 list_for_each_entry(wrk, &ubi->works, list) { 1726 list_for_each_entry_safe(wrk, tmp, &ubi->works, list) {
1727 if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) && 1727 if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) &&
1728 (lnum == UBI_ALL || wrk->lnum == lnum)) { 1728 (lnum == UBI_ALL || wrk->lnum == lnum)) {
1729 list_del(&wrk->list); 1729 list_del(&wrk->list);
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c
index ff8229340cd5..aa13ad053b14 100644
--- a/fs/ubifs/commit.c
+++ b/fs/ubifs/commit.c
@@ -174,7 +174,6 @@ static int do_commit(struct ubifs_info *c)
174 if (err) 174 if (err)
175 goto out; 175 goto out;
176 176
177 mutex_lock(&c->mst_mutex);
178 c->mst_node->cmt_no = cpu_to_le64(c->cmt_no); 177 c->mst_node->cmt_no = cpu_to_le64(c->cmt_no);
179 c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum); 178 c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum);
180 c->mst_node->root_lnum = cpu_to_le32(zroot.lnum); 179 c->mst_node->root_lnum = cpu_to_le32(zroot.lnum);
@@ -204,7 +203,6 @@ static int do_commit(struct ubifs_info *c)
204 else 203 else
205 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS); 204 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS);
206 err = ubifs_write_master(c); 205 err = ubifs_write_master(c);
207 mutex_unlock(&c->mst_mutex);
208 if (err) 206 if (err)
209 goto out; 207 goto out;
210 208
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 2290d5866725..fb08b0c514b6 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -431,7 +431,7 @@ void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last)
431 431
432/** 432/**
433 * wbuf_timer_callback - write-buffer timer callback function. 433 * wbuf_timer_callback - write-buffer timer callback function.
434 * @data: timer data (write-buffer descriptor) 434 * @timer: timer data (write-buffer descriptor)
435 * 435 *
436 * This function is called when the write-buffer timer expires. 436 * This function is called when the write-buffer timer expires.
437 */ 437 */
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index a902c5919e42..a47ddfc9be6b 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -240,6 +240,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs)
240 240
241 if (c->lhead_offs > c->leb_size - c->ref_node_alsz) { 241 if (c->lhead_offs > c->leb_size - c->ref_node_alsz) {
242 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); 242 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
243 ubifs_assert(c->lhead_lnum != c->ltail_lnum);
243 c->lhead_offs = 0; 244 c->lhead_offs = 0;
244 } 245 }
245 246
@@ -404,15 +405,14 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum)
404 /* Switch to the next log LEB */ 405 /* Switch to the next log LEB */
405 if (c->lhead_offs) { 406 if (c->lhead_offs) {
406 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); 407 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
408 ubifs_assert(c->lhead_lnum != c->ltail_lnum);
407 c->lhead_offs = 0; 409 c->lhead_offs = 0;
408 } 410 }
409 411
410 if (c->lhead_offs == 0) { 412 /* Must ensure next LEB has been unmapped */
411 /* Must ensure next LEB has been unmapped */ 413 err = ubifs_leb_unmap(c, c->lhead_lnum);
412 err = ubifs_leb_unmap(c, c->lhead_lnum); 414 if (err)
413 if (err) 415 goto out;
414 goto out;
415 }
416 416
417 len = ALIGN(len, c->min_io_size); 417 len = ALIGN(len, c->min_io_size);
418 dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len); 418 dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len);
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index d46b19ec1815..421bd0a80424 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -1464,7 +1464,6 @@ struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum)
1464 return ERR_CAST(nnode); 1464 return ERR_CAST(nnode);
1465 } 1465 }
1466 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1)); 1466 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1));
1467 shft -= UBIFS_LPT_FANOUT_SHIFT;
1468 pnode = ubifs_get_pnode(c, nnode, iip); 1467 pnode = ubifs_get_pnode(c, nnode, iip);
1469 if (IS_ERR(pnode)) 1468 if (IS_ERR(pnode))
1470 return ERR_CAST(pnode); 1469 return ERR_CAST(pnode);
@@ -1604,7 +1603,6 @@ struct ubifs_lprops *ubifs_lpt_lookup_dirty(struct ubifs_info *c, int lnum)
1604 return ERR_CAST(nnode); 1603 return ERR_CAST(nnode);
1605 } 1604 }
1606 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1)); 1605 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1));
1607 shft -= UBIFS_LPT_FANOUT_SHIFT;
1608 pnode = ubifs_get_pnode(c, nnode, iip); 1606 pnode = ubifs_get_pnode(c, nnode, iip);
1609 if (IS_ERR(pnode)) 1607 if (IS_ERR(pnode))
1610 return ERR_CAST(pnode); 1608 return ERR_CAST(pnode);
@@ -1964,7 +1962,6 @@ again:
1964 } 1962 }
1965 } 1963 }
1966 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1)); 1964 iip = ((i >> shft) & (UBIFS_LPT_FANOUT - 1));
1967 shft -= UBIFS_LPT_FANOUT_SHIFT;
1968 pnode = scan_get_pnode(c, path + h, nnode, iip); 1965 pnode = scan_get_pnode(c, path + h, nnode, iip);
1969 if (IS_ERR(pnode)) { 1966 if (IS_ERR(pnode)) {
1970 err = PTR_ERR(pnode); 1967 err = PTR_ERR(pnode);
@@ -2198,6 +2195,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
2198 lprops->dirty); 2195 lprops->dirty);
2199 return -EINVAL; 2196 return -EINVAL;
2200 } 2197 }
2198 break;
2201 case LPROPS_FREEABLE: 2199 case LPROPS_FREEABLE:
2202 case LPROPS_FRDI_IDX: 2200 case LPROPS_FRDI_IDX:
2203 if (lprops->free + lprops->dirty != c->leb_size) { 2201 if (lprops->free + lprops->dirty != c->leb_size) {
@@ -2206,6 +2204,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
2206 lprops->dirty); 2204 lprops->dirty);
2207 return -EINVAL; 2205 return -EINVAL;
2208 } 2206 }
2207 break;
2209 } 2208 }
2210 } 2209 }
2211 return 0; 2210 return 0;
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 45d4e96a6bac..d9c02928e992 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -304,7 +304,6 @@ static int layout_cnodes(struct ubifs_info *c)
304 ubifs_assert(lnum >= c->lpt_first && 304 ubifs_assert(lnum >= c->lpt_first &&
305 lnum <= c->lpt_last); 305 lnum <= c->lpt_last);
306 } 306 }
307 done_ltab = 1;
308 c->ltab_lnum = lnum; 307 c->ltab_lnum = lnum;
309 c->ltab_offs = offs; 308 c->ltab_offs = offs;
310 offs += c->ltab_sz; 309 offs += c->ltab_sz;
@@ -514,7 +513,6 @@ static int write_cnodes(struct ubifs_info *c)
514 if (err) 513 if (err)
515 return err; 514 return err;
516 } 515 }
517 done_ltab = 1;
518 ubifs_pack_ltab(c, buf + offs, c->ltab_cmt); 516 ubifs_pack_ltab(c, buf + offs, c->ltab_cmt);
519 offs += c->ltab_sz; 517 offs += c->ltab_sz;
520 dbg_chk_lpt_sz(c, 1, c->ltab_sz); 518 dbg_chk_lpt_sz(c, 1, c->ltab_sz);
@@ -1941,6 +1939,11 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
1941 pr_err("LEB %d:%d, nnode, ", 1939 pr_err("LEB %d:%d, nnode, ",
1942 lnum, offs); 1940 lnum, offs);
1943 err = ubifs_unpack_nnode(c, p, &nnode); 1941 err = ubifs_unpack_nnode(c, p, &nnode);
1942 if (err) {
1943 pr_err("failed to unpack_node, error %d\n",
1944 err);
1945 break;
1946 }
1944 for (i = 0; i < UBIFS_LPT_FANOUT; i++) { 1947 for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
1945 pr_cont("%d:%d", nnode.nbranch[i].lnum, 1948 pr_cont("%d:%d", nnode.nbranch[i].lnum,
1946 nnode.nbranch[i].offs); 1949 nnode.nbranch[i].offs);
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index ab83ace9910a..1a4bb9e8b3b8 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -352,10 +352,9 @@ int ubifs_read_master(struct ubifs_info *c)
352 * ubifs_write_master - write master node. 352 * ubifs_write_master - write master node.
353 * @c: UBIFS file-system description object 353 * @c: UBIFS file-system description object
354 * 354 *
355 * This function writes the master node. The caller has to take the 355 * This function writes the master node. Returns zero in case of success and a
356 * @c->mst_mutex lock before calling this function. Returns zero in case of 356 * negative error code in case of failure. The master node is written twice to
357 * success and a negative error code in case of failure. The master node is 357 * enable recovery.
358 * written twice to enable recovery.
359 */ 358 */
360int ubifs_write_master(struct ubifs_info *c) 359int ubifs_write_master(struct ubifs_info *c)
361{ 360{
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index f1c3e5a1b315..4409f486ecef 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -346,7 +346,6 @@ static int write_orph_nodes(struct ubifs_info *c, int atomic)
346 int lnum; 346 int lnum;
347 347
348 /* Unmap any unused LEBs after consolidation */ 348 /* Unmap any unused LEBs after consolidation */
349 lnum = c->ohead_lnum + 1;
350 for (lnum = c->ohead_lnum + 1; lnum <= c->orph_last; lnum++) { 349 for (lnum = c->ohead_lnum + 1; lnum <= c->orph_last; lnum++) {
351 err = ubifs_leb_unmap(c, lnum); 350 err = ubifs_leb_unmap(c, lnum);
352 if (err) 351 if (err)
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index c14adb2f420c..c640938f62f0 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -596,7 +596,6 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs)
596 * drop_last_node - drop the last node. 596 * drop_last_node - drop the last node.
597 * @sleb: scanned LEB information 597 * @sleb: scanned LEB information
598 * @offs: offset of dropped nodes is returned here 598 * @offs: offset of dropped nodes is returned here
599 * @grouped: non-zero if whole group of nodes have to be dropped
600 * 599 *
601 * This is a helper function for 'ubifs_recover_leb()' which drops the last 600 * This is a helper function for 'ubifs_recover_leb()' which drops the last
602 * node of the scanned LEB. 601 * node of the scanned LEB.
@@ -629,8 +628,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
629 * 628 *
630 * This function does a scan of a LEB, but caters for errors that might have 629 * This function does a scan of a LEB, but caters for errors that might have
631 * been caused by the unclean unmount from which we are attempting to recover. 630 * been caused by the unclean unmount from which we are attempting to recover.
632 * Returns %0 in case of success, %-EUCLEAN if an unrecoverable corruption is 631 * Returns the scanned information on success and a negative error code on
633 * found, and a negative error code in case of failure. 632 * failure.
634 */ 633 */
635struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, 634struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
636 int offs, void *sbuf, int jhead) 635 int offs, void *sbuf, int jhead)
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 4c37607a958e..79c6dbbc0e04 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -332,6 +332,8 @@ static int create_default_filesystem(struct ubifs_info *c)
332 cs->ch.node_type = UBIFS_CS_NODE; 332 cs->ch.node_type = UBIFS_CS_NODE;
333 err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0); 333 err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0);
334 kfree(cs); 334 kfree(cs);
335 if (err)
336 return err;
335 337
336 ubifs_msg("default file-system created"); 338 ubifs_msg("default file-system created");
337 return 0; 339 return 0;
@@ -447,7 +449,7 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
447 goto failed; 449 goto failed;
448 } 450 }
449 451
450 if (c->default_compr < 0 || c->default_compr >= UBIFS_COMPR_TYPES_CNT) { 452 if (c->default_compr >= UBIFS_COMPR_TYPES_CNT) {
451 err = 13; 453 err = 13;
452 goto failed; 454 goto failed;
453 } 455 }
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 58aa05df2bb6..89adbc4d08ac 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -131,7 +131,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
131 * @offs: offset to start at (usually zero) 131 * @offs: offset to start at (usually zero)
132 * @sbuf: scan buffer (must be c->leb_size) 132 * @sbuf: scan buffer (must be c->leb_size)
133 * 133 *
134 * This function returns %0 on success and a negative error code on failure. 134 * This function returns the scanned information on success and a negative error
135 * code on failure.
135 */ 136 */
136struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, 137struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
137 int offs, void *sbuf) 138 int offs, void *sbuf)
@@ -157,9 +158,10 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
157 return ERR_PTR(err); 158 return ERR_PTR(err);
158 } 159 }
159 160
160 if (err == -EBADMSG) 161 /*
161 sleb->ecc = 1; 162 * Note, we ignore integrity errors (EBASMSG) because all the nodes are
162 163 * protected by CRC checksums.
164 */
163 return sleb; 165 return sleb;
164} 166}
165 167
@@ -169,8 +171,6 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
169 * @sleb: scanning information 171 * @sleb: scanning information
170 * @lnum: logical eraseblock number 172 * @lnum: logical eraseblock number
171 * @offs: offset to start at (usually zero) 173 * @offs: offset to start at (usually zero)
172 *
173 * This function returns %0 on success and a negative error code on failure.
174 */ 174 */
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)
@@ -257,7 +257,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
257 * @quiet: print no messages 257 * @quiet: print no messages
258 * 258 *
259 * This function scans LEB number @lnum and returns complete information about 259 * This function scans LEB number @lnum and returns complete information about
260 * its contents. Returns the scaned information in case of success and, 260 * its contents. Returns the scanned information in case of success and,
261 * %-EUCLEAN if the LEB neads recovery, and other negative error codes in case 261 * %-EUCLEAN if the LEB neads recovery, and other negative error codes in case
262 * of failure. 262 * of failure.
263 * 263 *
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 3904c8574ef9..106bf20629ce 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -75,7 +75,7 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
75 return 1; 75 return 1;
76 } 76 }
77 77
78 if (ui->compr_type < 0 || ui->compr_type >= UBIFS_COMPR_TYPES_CNT) { 78 if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) {
79 ubifs_err("unknown compression type %d", ui->compr_type); 79 ubifs_err("unknown compression type %d", ui->compr_type);
80 return 2; 80 return 2;
81 } 81 }
@@ -424,19 +424,19 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root)
424 struct ubifs_info *c = root->d_sb->s_fs_info; 424 struct ubifs_info *c = root->d_sb->s_fs_info;
425 425
426 if (c->mount_opts.unmount_mode == 2) 426 if (c->mount_opts.unmount_mode == 2)
427 seq_printf(s, ",fast_unmount"); 427 seq_puts(s, ",fast_unmount");
428 else if (c->mount_opts.unmount_mode == 1) 428 else if (c->mount_opts.unmount_mode == 1)
429 seq_printf(s, ",norm_unmount"); 429 seq_puts(s, ",norm_unmount");
430 430
431 if (c->mount_opts.bulk_read == 2) 431 if (c->mount_opts.bulk_read == 2)
432 seq_printf(s, ",bulk_read"); 432 seq_puts(s, ",bulk_read");
433 else if (c->mount_opts.bulk_read == 1) 433 else if (c->mount_opts.bulk_read == 1)
434 seq_printf(s, ",no_bulk_read"); 434 seq_puts(s, ",no_bulk_read");
435 435
436 if (c->mount_opts.chk_data_crc == 2) 436 if (c->mount_opts.chk_data_crc == 2)
437 seq_printf(s, ",chk_data_crc"); 437 seq_puts(s, ",chk_data_crc");
438 else if (c->mount_opts.chk_data_crc == 1) 438 else if (c->mount_opts.chk_data_crc == 1)
439 seq_printf(s, ",no_chk_data_crc"); 439 seq_puts(s, ",no_chk_data_crc");
440 440
441 if (c->mount_opts.override_compr) { 441 if (c->mount_opts.override_compr) {
442 seq_printf(s, ",compr=%s", 442 seq_printf(s, ",compr=%s",
@@ -796,8 +796,8 @@ static int alloc_wbufs(struct ubifs_info *c)
796{ 796{
797 int i, err; 797 int i, err;
798 798
799 c->jheads = kzalloc(c->jhead_cnt * sizeof(struct ubifs_jhead), 799 c->jheads = kcalloc(c->jhead_cnt, sizeof(struct ubifs_jhead),
800 GFP_KERNEL); 800 GFP_KERNEL);
801 if (!c->jheads) 801 if (!c->jheads)
802 return -ENOMEM; 802 return -ENOMEM;
803 803
@@ -1963,7 +1963,6 @@ static struct ubifs_info *alloc_ubifs_info(struct ubi_volume_desc *ubi)
1963 mutex_init(&c->lp_mutex); 1963 mutex_init(&c->lp_mutex);
1964 mutex_init(&c->tnc_mutex); 1964 mutex_init(&c->tnc_mutex);
1965 mutex_init(&c->log_mutex); 1965 mutex_init(&c->log_mutex);
1966 mutex_init(&c->mst_mutex);
1967 mutex_init(&c->umount_mutex); 1966 mutex_init(&c->umount_mutex);
1968 mutex_init(&c->bu_mutex); 1967 mutex_init(&c->bu_mutex);
1969 mutex_init(&c->write_reserve_mutex); 1968 mutex_init(&c->write_reserve_mutex);
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 8a40cf9c02d7..6793db0754f6 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -3294,7 +3294,6 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
3294 goto out_unlock; 3294 goto out_unlock;
3295 3295
3296 if (err) { 3296 if (err) {
3297 err = -EINVAL;
3298 key = &from_key; 3297 key = &from_key;
3299 goto out_dump; 3298 goto out_dump;
3300 } 3299 }
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 3600994f8411..7a205e046776 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -389,7 +389,6 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
389 ubifs_dump_lprops(c); 389 ubifs_dump_lprops(c);
390 } 390 }
391 /* Try to commit anyway */ 391 /* Try to commit anyway */
392 err = 0;
393 break; 392 break;
394 } 393 }
395 p++; 394 p++;
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index c1f71fe17cc0..c4fe900c67ab 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -314,7 +314,6 @@ struct ubifs_scan_node {
314 * @nodes_cnt: number of nodes scanned 314 * @nodes_cnt: number of nodes scanned
315 * @nodes: list of struct ubifs_scan_node 315 * @nodes: list of struct ubifs_scan_node
316 * @endpt: end point (and therefore the start of empty space) 316 * @endpt: end point (and therefore the start of empty space)
317 * @ecc: read returned -EBADMSG
318 * @buf: buffer containing entire LEB scanned 317 * @buf: buffer containing entire LEB scanned
319 */ 318 */
320struct ubifs_scan_leb { 319struct ubifs_scan_leb {
@@ -322,7 +321,6 @@ struct ubifs_scan_leb {
322 int nodes_cnt; 321 int nodes_cnt;
323 struct list_head nodes; 322 struct list_head nodes;
324 int endpt; 323 int endpt;
325 int ecc;
326 void *buf; 324 void *buf;
327}; 325};
328 326
@@ -1051,7 +1049,6 @@ struct ubifs_debug_info;
1051 * 1049 *
1052 * @mst_node: master node 1050 * @mst_node: master node
1053 * @mst_offs: offset of valid master node 1051 * @mst_offs: offset of valid master node
1054 * @mst_mutex: protects the master node area, @mst_node, and @mst_offs
1055 * 1052 *
1056 * @max_bu_buf_len: maximum bulk-read buffer length 1053 * @max_bu_buf_len: maximum bulk-read buffer length
1057 * @bu_mutex: protects the pre-allocated bulk-read buffer and @c->bu 1054 * @bu_mutex: protects the pre-allocated bulk-read buffer and @c->bu
@@ -1292,7 +1289,6 @@ struct ubifs_info {
1292 1289
1293 struct ubifs_mst_node *mst_node; 1290 struct ubifs_mst_node *mst_node;
1294 int mst_offs; 1291 int mst_offs;
1295 struct mutex mst_mutex;
1296 1292
1297 int max_bu_buf_len; 1293 int max_bu_buf_len;
1298 struct mutex bu_mutex; 1294 struct mutex bu_mutex;