Merge branch 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Sep 2016 20:39:37 +0000 (13:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Sep 2016 20:39:37 +0000 (13:39 -0700)
Pull btrfs fixes from Chris Mason:
 "Josef fixed a problem when quotas are enabled with his latest ENOSPC
  rework, and Jeff added more checks into the subvol ioctls to avoid
  tripping up lookup_one_len"

* 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: ensure that file descriptor used with subvol ioctls is a dir
  Btrfs: handle quota reserve failure properly

1  2 
fs/btrfs/extent-tree.c

diff --combined fs/btrfs/extent-tree.c
index 38c2df84cabd0cf2116239d1cf08d1d18709890f,db76cc18c562f272157a3aafbad497d1256bc60d..665da8f66ff18ae5260f892b60a4bafb4fe323fa
@@@ -2044,7 -2044,7 +2044,7 @@@ int btrfs_discard_extent(struct btrfs_r
         */
        btrfs_bio_counter_inc_blocked(root->fs_info);
        /* Tell the block device(s) that the sectors can be discarded */
 -      ret = btrfs_map_block(root->fs_info, REQ_DISCARD,
 +      ret = btrfs_map_block(root->fs_info, REQ_OP_DISCARD,
                              bytenr, &num_bytes, &bbio, 0);
        /* Error condition is -ENOMEM */
        if (!ret) {
@@@ -4271,13 -4271,10 +4271,10 @@@ int btrfs_check_data_free_space(struct 
        if (ret < 0)
                return ret;
  
-       /*
-        * Use new btrfs_qgroup_reserve_data to reserve precious data space
-        *
-        * TODO: Find a good method to avoid reserve data space for NOCOW
-        * range, but don't impact performance on quota disable case.
-        */
+       /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */
        ret = btrfs_qgroup_reserve_data(inode, start, len);
+       if (ret)
+               btrfs_free_reserved_data_space_noquota(inode, start, len);
        return ret;
  }