]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Btrfs: reserve space for O_TMPFILE orphan item deletion
authorOmar Sandoval <osandov@fb.com>
Fri, 11 May 2018 20:13:40 +0000 (13:13 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:24:00 +0000 (18:24 +0200)
btrfs_link() calls btrfs_orphan_del() if it's linking an O_TMPFILE but
it doesn't reserve space to do so. Even before the removal of the
orphan_block_rsv it wasn't using it.

Fixes: ef3b9af50bfa ("Btrfs: implement inode_operations callback tmpfile")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index b247ea31c436ba0e10d9ff04fa8ba2d3c01ec445..6e9cb5338964ecc832886e7806ced6d5efa69a7f 100644 (file)
@@ -6658,8 +6658,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
         * 2 items for inode and inode ref
         * 2 items for dir items
         * 1 item for parent inode
+        * 1 item for orphan item deletion if O_TMPFILE
         */
-       trans = btrfs_start_transaction(root, 5);
+       trans = btrfs_start_transaction(root, inode->i_nlink ? 5 : 6);
        if (IS_ERR(trans)) {
                err = PTR_ERR(trans);
                trans = NULL;