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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: The file argument for fsync() is never null
Btrfs: handle ERR_PTR from posix_acl_from_xattr()
Btrfs: avoid BUG when dropping root and reference in same transaction
Btrfs: prohibit a operation of changing acl's mask when noacl mount option used
Btrfs: should add a permission check for setfacl
Btrfs: btrfs_lookup_dir_item() can return ERR_PTR
Btrfs: btrfs_read_fs_root_no_name() returns ERR_PTRs
Btrfs: unwind after btrfs_start_transaction() errors
Btrfs: btrfs_iget() returns ERR_PTR
Btrfs: handle kzalloc() failure in open_ctree()
Btrfs: handle error returns from btrfs_lookup_dir_item()
Btrfs: Fix BUG_ON for fs converted from extN
Btrfs: Fix null dereference in relocation.c
Btrfs: fix remap_file_pages error
Btrfs: uninitialized data is check_path_shared()
Btrfs: fix fallocate regression
Btrfs: fix loop device on top of btrfs

+41 -17
+8
fs/btrfs/acl.c
··· 60 60 size = __btrfs_getxattr(inode, name, value, size); 61 61 if (size > 0) { 62 62 acl = posix_acl_from_xattr(value, size); 63 + if (IS_ERR(acl)) 64 + return acl; 63 65 set_cached_acl(inode, type, acl); 64 66 } 65 67 kfree(value); ··· 161 159 { 162 160 int ret; 163 161 struct posix_acl *acl = NULL; 162 + 163 + if (!is_owner_or_cap(dentry->d_inode)) 164 + return -EPERM; 165 + 166 + if (!IS_POSIXACL(dentry->d_inode)) 167 + return -EOPNOTSUPP; 164 168 165 169 if (value) { 166 170 acl = posix_acl_from_xattr(value, size);
+9 -2
fs/btrfs/disk-io.c
··· 1941 1941 btrfs_level_size(tree_root, 1942 1942 btrfs_super_log_root_level(disk_super)); 1943 1943 1944 - log_tree_root = kzalloc(sizeof(struct btrfs_root), 1945 - GFP_NOFS); 1944 + log_tree_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS); 1945 + if (!log_tree_root) { 1946 + err = -ENOMEM; 1947 + goto fail_trans_kthread; 1948 + } 1946 1949 1947 1950 __setup_root(nodesize, leafsize, sectorsize, stripesize, 1948 1951 log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); ··· 1985 1982 fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); 1986 1983 if (!fs_info->fs_root) 1987 1984 goto fail_trans_kthread; 1985 + if (IS_ERR(fs_info->fs_root)) { 1986 + err = PTR_ERR(fs_info->fs_root); 1987 + goto fail_trans_kthread; 1988 + } 1988 1989 1989 1990 if (!(sb->s_flags & MS_RDONLY)) { 1990 1991 down_read(&fs_info->cleanup_work_sem);
+2 -1
fs/btrfs/extent-tree.c
··· 4360 4360 4361 4361 block_rsv = get_block_rsv(trans, root); 4362 4362 cache = btrfs_lookup_block_group(root->fs_info, buf->start); 4363 - BUG_ON(block_rsv->space_info != cache->space_info); 4363 + if (block_rsv->space_info != cache->space_info) 4364 + goto out; 4364 4365 4365 4366 if (btrfs_header_generation(buf) == trans->transid) { 4366 4367 if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
+10 -2
fs/btrfs/file.c
··· 1140 1140 /* 1141 1141 * ok we haven't committed the transaction yet, lets do a commit 1142 1142 */ 1143 - if (file && file->private_data) 1143 + if (file->private_data) 1144 1144 btrfs_ioctl_trans_end(file); 1145 1145 1146 1146 trans = btrfs_start_transaction(root, 0); ··· 1190 1190 1191 1191 static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) 1192 1192 { 1193 - vma->vm_ops = &btrfs_file_vm_ops; 1193 + struct address_space *mapping = filp->f_mapping; 1194 + 1195 + if (!mapping->a_ops->readpage) 1196 + return -ENOEXEC; 1197 + 1194 1198 file_accessed(filp); 1199 + vma->vm_ops = &btrfs_file_vm_ops; 1200 + vma->vm_flags |= VM_CAN_NONLINEAR; 1201 + 1195 1202 return 0; 1196 1203 } 1197 1204 1198 1205 const struct file_operations btrfs_file_operations = { 1199 1206 .llseek = generic_file_llseek, 1200 1207 .read = do_sync_read, 1208 + .write = do_sync_write, 1201 1209 .aio_read = generic_file_aio_read, 1202 1210 .splice_read = generic_file_splice_read, 1203 1211 .aio_write = btrfs_file_aio_write,
+2 -2
fs/btrfs/inode.c
··· 2673 2673 struct extent_buffer *eb; 2674 2674 int level; 2675 2675 int ret; 2676 - u64 refs; 2676 + u64 refs = 1; 2677 2677 2678 2678 for (level = 0; level < BTRFS_MAX_LEVEL; level++) { 2679 2679 if (!path->nodes[level]) ··· 6884 6884 if (em->block_start == EXTENT_MAP_HOLE || 6885 6885 (cur_offset >= inode->i_size && 6886 6886 !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { 6887 - ret = btrfs_prealloc_file_range(inode, 0, cur_offset, 6887 + ret = btrfs_prealloc_file_range(inode, mode, cur_offset, 6888 6888 last_byte - cur_offset, 6889 6889 1 << inode->i_blkbits, 6890 6890 offset + len,
+2 -2
fs/btrfs/ioctl.c
··· 1280 1280 trans = btrfs_start_transaction(root, 0); 1281 1281 if (IS_ERR(trans)) { 1282 1282 err = PTR_ERR(trans); 1283 - goto out; 1283 + goto out_up_write; 1284 1284 } 1285 1285 trans->block_rsv = &root->fs_info->global_block_rsv; 1286 1286 ··· 1845 1845 dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); 1846 1846 di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, 1847 1847 dir_id, "default", 7, 1); 1848 - if (!di) { 1848 + if (IS_ERR_OR_NULL(di)) { 1849 1849 btrfs_free_path(path); 1850 1850 btrfs_end_transaction(trans, root); 1851 1851 printk(KERN_ERR "Umm, you don't have the default dir item, "
+4 -3
fs/btrfs/relocation.c
··· 784 784 struct btrfs_extent_ref_v0 *ref0; 785 785 ref0 = btrfs_item_ptr(eb, path1->slots[0], 786 786 struct btrfs_extent_ref_v0); 787 - root = find_tree_root(rc, eb, ref0); 788 - if (!root->ref_cows) 789 - cur->cowonly = 1; 790 787 if (key.objectid == key.offset) { 788 + root = find_tree_root(rc, eb, ref0); 791 789 if (root && !should_ignore_root(root)) 792 790 cur->root = root; 793 791 else 794 792 list_add(&cur->list, &useless); 795 793 break; 796 794 } 795 + if (is_cowonly_root(btrfs_ref_root_v0(eb, 796 + ref0))) 797 + cur->cowonly = 1; 797 798 } 798 799 #else 799 800 BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY);
-3
fs/btrfs/root-tree.c
··· 330 330 { 331 331 struct btrfs_path *path; 332 332 int ret; 333 - u32 refs; 334 333 struct btrfs_root_item *ri; 335 334 struct extent_buffer *leaf; 336 335 ··· 343 344 leaf = path->nodes[0]; 344 345 ri = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_item); 345 346 346 - refs = btrfs_disk_root_refs(leaf, ri); 347 - BUG_ON(refs != 0); 348 347 ret = btrfs_del_item(trans, root, path); 349 348 out: 350 349 btrfs_free_path(path);
+4 -2
fs/btrfs/super.c
··· 360 360 */ 361 361 dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); 362 362 di = btrfs_lookup_dir_item(NULL, root, path, dir_id, "default", 7, 0); 363 + if (IS_ERR(di)) 364 + return ERR_CAST(di); 363 365 if (!di) { 364 366 /* 365 367 * Ok the default dir item isn't there. This is weird since ··· 392 390 location.offset = 0; 393 391 394 392 inode = btrfs_iget(sb, &location, new_root, &new); 395 - if (!inode) 396 - return ERR_PTR(-ENOMEM); 393 + if (IS_ERR(inode)) 394 + return ERR_CAST(inode); 397 395 398 396 /* 399 397 * If we're just mounting the root most subvol put the inode and return