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;