Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 26 Mar 2017 17:29:21 +0000 (10:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 26 Mar 2017 17:29:21 +0000 (10:29 -0700)
Pull ext4 fixes from Ted Ts'o:
 "Fix a memory leak on an error path, and two races when modifying
  inodes relating to the inline_data and metadata checksum features"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix two spelling nits
  ext4: lock the xattr block before checksuming it
  jbd2: don't leak memory if setting up journal fails
  ext4: mark inode dirty after converting inline directory

1  2 
fs/ext4/inode.c
fs/ext4/move_extent.c

diff --combined fs/ext4/inode.c
index 7385e6a6b6cb549041d098a565c36c20794f7f14,f303d3a7f44ae2c9d4d4950439f728d89ba49ee1..4247d8d25687814dd1b844ea5555feeb43854d99
@@@ -2221,7 -2221,7 +2221,7 @@@ static int mpage_process_page_bufs(stru
  {
        struct inode *inode = mpd->inode;
        int err;
 -      ext4_lblk_t blocks = (i_size_read(inode) + (1 << inode->i_blkbits) - 1)
 +      ext4_lblk_t blocks = (i_size_read(inode) + i_blocksize(inode) - 1)
                                                        >> inode->i_blkbits;
  
        do {
@@@ -3450,7 -3450,7 +3450,7 @@@ orphan_del
        return ret;
  }
  
 -struct iomap_ops ext4_iomap_ops = {
 +const struct iomap_ops ext4_iomap_ops = {
        .iomap_begin            = ext4_iomap_begin,
        .iomap_end              = ext4_iomap_end,
  };
@@@ -3577,7 -3577,7 +3577,7 @@@ static ssize_t ext4_direct_IO_write(str
        if (overwrite)
                get_block_func = ext4_dio_get_block_overwrite;
        else if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) ||
 -                 round_down(offset, 1 << inode->i_blkbits) >= inode->i_size) {
 +                 round_down(offset, i_blocksize(inode)) >= inode->i_size) {
                get_block_func = ext4_dio_get_block;
                dio_flags = DIO_LOCKING | DIO_SKIP_HOLES;
        } else if (is_sync_kiocb(iocb)) {
@@@ -5179,7 -5179,7 +5179,7 @@@ static void ext4_wait_for_tail_page_com
         * do. We do the check mainly to optimize the common PAGE_SIZE ==
         * blocksize case
         */
 -      if (offset > PAGE_SIZE - (1 << inode->i_blkbits))
 +      if (offset > PAGE_SIZE - i_blocksize(inode))
                return;
        while (1) {
                page = find_lock_page(inode->i_mapping,
@@@ -5387,20 -5387,20 +5387,20 @@@ err_out
        return error;
  }
  
 -int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
 -               struct kstat *stat)
 +int ext4_getattr(const struct path *path, struct kstat *stat,
 +               u32 request_mask, unsigned int query_flags)
  {
        struct inode *inode;
        unsigned long long delalloc_blocks;
  
 -      inode = d_inode(dentry);
 +      inode = d_inode(path->dentry);
        generic_fillattr(inode, stat);
  
        /*
         * If there is inline data in the inode, the inode will normally not
         * have data blocks allocated (it may have an external xattr block).
         * Report at least one sector for such files, so tools like tar, rsync,
-        * others doen't incorrectly think the file is completely sparse.
+        * others don't incorrectly think the file is completely sparse.
         */
        if (unlikely(ext4_has_inline_data(inode)))
                stat->blocks += (stat->size + 511) >> 9;
@@@ -5821,9 -5821,8 +5821,9 @@@ static int ext4_bh_unmapped(handle_t *h
        return !buffer_mapped(bh);
  }
  
 -int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 +int ext4_page_mkwrite(struct vm_fault *vmf)
  {
 +      struct vm_area_struct *vma = vmf->vma;
        struct page *page = vmf->page;
        loff_t size;
        unsigned long len;
        return ret;
  }
  
 -int ext4_filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 +int ext4_filemap_fault(struct vm_fault *vmf)
  {
 -      struct inode *inode = file_inode(vma->vm_file);
 +      struct inode *inode = file_inode(vmf->vma->vm_file);
        int err;
  
        down_read(&EXT4_I(inode)->i_mmap_sem);
 -      err = filemap_fault(vma, vmf);
 +      err = filemap_fault(vmf);
        up_read(&EXT4_I(inode)->i_mmap_sem);
  
        return err;
diff --combined fs/ext4/move_extent.c
index 578f8c33fb44ad34062e978277f5def1d8aeebe1,615bc03d0fbdf3cbb79c15d993a18fef6c371610..c992ef2c2f94c0865d14de67e2c5b99857edf71f
@@@ -187,7 -187,7 +187,7 @@@ mext_page_mkuptodate(struct page *page
        if (PageUptodate(page))
                return 0;
  
 -      blocksize = 1 << inode->i_blkbits;
 +      blocksize = i_blocksize(inode);
        if (!page_has_buffers(page))
                create_empty_buffers(page, blocksize, 0);
  
@@@ -511,7 -511,7 +511,7 @@@ mext_check_arguments(struct inode *orig
        if ((orig_start & ~(PAGE_MASK >> orig_inode->i_blkbits)) !=
            (donor_start & ~(PAGE_MASK >> orig_inode->i_blkbits))) {
                ext4_debug("ext4 move extent: orig and donor's start "
-                       "offset are not alligned [ino:orig %lu, donor %lu]\n",
+                       "offsets are not aligned [ino:orig %lu, donor %lu]\n",
                        orig_inode->i_ino, donor_inode->i_ino);
                return -EINVAL;
        }