]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Mar 2017 18:39:33 +0000 (11:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Mar 2017 18:39:33 +0000 (11:39 -0700)
Pull btrfs fixes from Chris Mason:
 "Zygo tracked down a very old bug with inline compressed extents.

  I didn't tag this one for stable because I want to do individual
  tested backports. It's a little tricky and I'd rather do some extra
  testing on it along the way"

* 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: add missing memset while reading compressed inline extents
  Btrfs: fix regression in lock_delalloc_pages
  btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

1  2 
fs/btrfs/inode.c

diff --combined fs/btrfs/inode.c
index c40060cc481f60440044d00ea4a76904cc4d9761,e57191072aa3845525617baebd569dccd60de27b..2315039356529fac0315a57733a035d86a00b3b1
@@@ -6709,6 -6709,20 +6709,20 @@@ static noinline int uncompress_inline(s
        max_size = min_t(unsigned long, PAGE_SIZE, max_size);
        ret = btrfs_decompress(compress_type, tmp, page,
                               extent_offset, inline_size, max_size);
+       /*
+        * decompression code contains a memset to fill in any space between the end
+        * of the uncompressed data and the end of max_size in case the decompressed
+        * data ends up shorter than ram_bytes.  That doesn't cover the hole between
+        * the end of an inline extent and the beginning of the next block, so we
+        * cover that region here.
+        */
+       if (max_size + pg_offset < PAGE_SIZE) {
+               char *map = kmap(page);
+               memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset);
+               kunmap(page);
+       }
        kfree(tmp);
        return ret;
  }
@@@ -8894,10 -8908,10 +8908,10 @@@ again
   * beyond EOF, then the page is guaranteed safe against truncation until we
   * unlock the page.
   */
 -int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 +int btrfs_page_mkwrite(struct vm_fault *vmf)
  {
        struct page *page = vmf->page;
 -      struct inode *inode = file_inode(vma->vm_file);
 +      struct inode *inode = file_inode(vmf->vma->vm_file);
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        struct btrfs_ordered_extent *ordered;
        ret = btrfs_delalloc_reserve_space(inode, page_start,
                                           reserved_space);
        if (!ret) {
 -              ret = file_update_time(vma->vm_file);
 +              ret = file_update_time(vmf->vma->vm_file);
                reserved = 1;
        }
        if (ret) {
@@@ -9413,11 -9427,11 +9427,11 @@@ fail
        return -ENOMEM;
  }
  
 -static int btrfs_getattr(struct vfsmount *mnt,
 -                       struct dentry *dentry, struct kstat *stat)
 +static int btrfs_getattr(const struct path *path, struct kstat *stat,
 +                       u32 request_mask, unsigned int flags)
  {
        u64 delalloc_bytes;
 -      struct inode *inode = d_inode(dentry);
 +      struct inode *inode = d_inode(path->dentry);
        u32 blocksize = inode->i_sb->s_blocksize;
  
        generic_fillattr(inode, stat);