Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'upstream-3.16-rc1-v2' of git://git.infradead.org/linux-ubifs

Pull UBIFS updates from Artem Bityutskiy:
"This contains several UBIFS fixes. One of them fixes a race condition
between the mmap page fault path and fsync. Another just removes a
bogus assertion from the UBIFS memory shrinker.

UBIFS also started honoring the MS_SILENT mount flag, so now it won't
print many I/O errors when user-space just tries to probe for the FS.

Rest of the changes are rather minor UBI/UBIFS fixes, improvements,
and clean-ups"

* tag 'upstream-3.16-rc1-v2' of git://git.infradead.org/linux-ubifs:
UBIFS: Add an assertion for clean_zn_cnt
UBIFS: respect MS_SILENT mount flag
UBIFS: Remove incorrect assertion in shrink_tnc()
UBIFS: fix debugging check
UBIFS: add missing ui pointer in debugging code
UBI: block: Fix error path on alloc_workqueue failure
UBIFS: Fix dump messages in ubifs_dump_lprops
UBI: fix rb_tree node comparison in add_map
UBIFS: Remove unused variables in ubifs_budget_space
UBI: weaken the 'exclusive' constraint when opening volumes to rename
UBIFS: fix an mmap and fsync race condition

+41 -20
+3 -1
drivers/mtd/ubi/block.c
··· 432 432 * Rembember workqueues are cheap, they're not threads. 433 433 */ 434 434 dev->wq = alloc_workqueue("%s", 0, 0, gd->disk_name); 435 - if (!dev->wq) 435 + if (!dev->wq) { 436 + ret = -ENOMEM; 436 437 goto out_free_queue; 438 + } 437 439 INIT_WORK(&dev->work, ubiblock_do_work); 438 440 439 441 mutex_lock(&devices_mutex);
+1 -1
drivers/mtd/ubi/cdev.c
··· 731 731 goto out_free; 732 732 } 733 733 734 - re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_EXCLUSIVE); 734 + re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_READWRITE); 735 735 if (IS_ERR(re->desc)) { 736 736 err = PTR_ERR(re->desc); 737 737 ubi_err("cannot open volume %d, error %d", vol_id, err);
+2 -2
drivers/mtd/ubi/fastmap.c
··· 125 125 parent = *p; 126 126 av = rb_entry(parent, struct ubi_ainf_volume, rb); 127 127 128 - if (vol_id > av->vol_id) 128 + if (vol_id < av->vol_id) 129 129 p = &(*p)->rb_left; 130 - else if (vol_id > av->vol_id) 130 + else 131 131 p = &(*p)->rb_right; 132 132 } 133 133
-1
fs/ubifs/budget.c
··· 437 437 */ 438 438 int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req) 439 439 { 440 - int uninitialized_var(cmt_retries), uninitialized_var(wb_retries); 441 440 int err, idx_growth, data_growth, dd_growth, retried = 0; 442 441 443 442 ubifs_assert(req->new_page <= 1);
+3 -1
fs/ubifs/debug.c
··· 745 745 746 746 for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { 747 747 err = ubifs_read_one_lp(c, lnum, &lp); 748 - if (err) 748 + if (err) { 749 749 ubifs_err("cannot read lprops for LEB %d", lnum); 750 + continue; 751 + } 750 752 751 753 ubifs_dump_lprop(c, &lp); 752 754 }
+3 -3
fs/ubifs/file.c
··· 903 903 struct ubifs_info *c = inode->i_sb->s_fs_info; 904 904 905 905 #ifdef UBIFS_DEBUG 906 + struct ubifs_inode *ui = ubifs_inode(inode); 906 907 spin_lock(&ui->ui_lock); 907 - ubifs_assert(page->index <= ui->synced_i_size << PAGE_CACHE_SIZE); 908 + ubifs_assert(page->index <= ui->synced_i_size >> PAGE_CACHE_SHIFT); 908 909 spin_unlock(&ui->ui_lock); 909 910 #endif 910 911 ··· 1526 1525 } 1527 1526 1528 1527 wait_for_stable_page(page); 1529 - unlock_page(page); 1530 - return 0; 1528 + return VM_FAULT_LOCKED; 1531 1529 1532 1530 out_unlock: 1533 1531 unlock_page(page);
+10 -8
fs/ubifs/io.c
··· 988 988 return err; 989 989 990 990 if (type != ch->node_type) { 991 - ubifs_err("bad node type (%d but expected %d)", 992 - ch->node_type, type); 991 + ubifs_errc(c, "bad node type (%d but expected %d)", 992 + ch->node_type, type); 993 993 goto out; 994 994 } 995 995 996 996 err = ubifs_check_node(c, buf, lnum, offs, 0, 0); 997 997 if (err) { 998 - ubifs_err("expected node type %d", type); 998 + ubifs_errc(c, "expected node type %d", type); 999 999 return err; 1000 1000 } 1001 1001 1002 1002 l = le32_to_cpu(ch->len); 1003 1003 if (l != len) { 1004 - ubifs_err("bad node length %d, expected %d", l, len); 1004 + ubifs_errc(c, "bad node length %d, expected %d", l, len); 1005 1005 goto out; 1006 1006 } 1007 1007 1008 1008 return 0; 1009 1009 1010 1010 out: 1011 - ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs, 1012 - ubi_is_mapped(c->ubi, lnum)); 1013 - ubifs_dump_node(c, buf); 1014 - dump_stack(); 1011 + ubifs_errc(c, "bad node at LEB %d:%d, LEB mapping status %d", lnum, 1012 + offs, ubi_is_mapped(c->ubi, lnum)); 1013 + if (!c->probing) { 1014 + ubifs_dump_node(c, buf); 1015 + dump_stack(); 1016 + } 1015 1017 return -EINVAL; 1016 1018 } 1017 1019
-1
fs/ubifs/shrinker.c
··· 128 128 freed = ubifs_destroy_tnc_subtree(znode); 129 129 atomic_long_sub(freed, &ubifs_clean_zn_cnt); 130 130 atomic_long_sub(freed, &c->clean_zn_cnt); 131 - ubifs_assert(atomic_long_read(&c->clean_zn_cnt) >= 0); 132 131 total_freed += freed; 133 132 znode = zprev; 134 133 }
+5
fs/ubifs/super.c
··· 1149 1149 size_t sz; 1150 1150 1151 1151 c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); 1152 + /* Suppress error messages while probing if MS_SILENT is set */ 1153 + c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); 1154 + 1152 1155 err = init_constants_early(c); 1153 1156 if (err) 1154 1157 return err; ··· 1216 1213 err = ubifs_read_superblock(c); 1217 1214 if (err) 1218 1215 goto out_free; 1216 + 1217 + c->probing = 0; 1219 1218 1220 1219 /* 1221 1220 * Make sure the compressor which is set as default in the superblock
+3 -2
fs/ubifs/tnc.c
··· 2859 2859 { 2860 2860 tnc_destroy_cnext(c); 2861 2861 if (c->zroot.znode) { 2862 - long n; 2862 + long n, freed; 2863 2863 2864 - ubifs_destroy_tnc_subtree(c->zroot.znode); 2865 2864 n = atomic_long_read(&c->clean_zn_cnt); 2865 + freed = ubifs_destroy_tnc_subtree(c->zroot.znode); 2866 + ubifs_assert(freed == n); 2866 2867 atomic_long_sub(n, &ubifs_clean_zn_cnt); 2867 2868 } 2868 2869 kfree(c->gap_lebs);
+11
fs/ubifs/ubifs.h
··· 51 51 #define ubifs_warn(fmt, ...) \ 52 52 pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ 53 53 current->pid, __func__, ##__VA_ARGS__) 54 + /* 55 + * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description 56 + * object as an argument. 57 + */ 58 + #define ubifs_errc(c, fmt, ...) \ 59 + do { \ 60 + if (!(c)->probing) \ 61 + ubifs_err(fmt, ##__VA_ARGS__); \ 62 + } while (0) 54 63 55 64 /* UBIFS file system VFS magic number */ 56 65 #define UBIFS_SUPER_MAGIC 0x24051905 ··· 1218 1209 * @need_recovery: %1 if the file-system needs recovery 1219 1210 * @replaying: %1 during journal replay 1220 1211 * @mounting: %1 while mounting 1212 + * @probing: %1 while attempting to mount if MS_SILENT mount flag is set 1221 1213 * @remounting_rw: %1 while re-mounting from R/O mode to R/W mode 1222 1214 * @replay_list: temporary list used during journal replay 1223 1215 * @replay_buds: list of buds to replay ··· 1451 1441 unsigned int replaying:1; 1452 1442 unsigned int mounting:1; 1453 1443 unsigned int remounting_rw:1; 1444 + unsigned int probing:1; 1454 1445 struct list_head replay_list; 1455 1446 struct list_head replay_buds; 1456 1447 unsigned long long cs_sqnum;