aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0efdb65953c..4a0107e1874 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4806,9 +4806,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4806 int err; 4806 int err;
4807 int drop_inode = 0; 4807 int drop_inode = 0;
4808 4808
4809 if (inode->i_nlink == 0)
4810 return -ENOENT;
4811
4812 /* do not allow sys_link's with other subvols of the same device */ 4809 /* do not allow sys_link's with other subvols of the same device */
4813 if (root->objectid != BTRFS_I(inode)->root->objectid) 4810 if (root->objectid != BTRFS_I(inode)->root->objectid)
4814 return -EPERM; 4811 return -EPERM;
@@ -4821,10 +4818,11 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4821 goto fail; 4818 goto fail;
4822 4819
4823 /* 4820 /*
4824 * 1 item for inode ref 4821 * 2 items for inode and inode ref
4825 * 2 items for dir items 4822 * 2 items for dir items
4823 * 1 item for parent inode
4826 */ 4824 */
4827 trans = btrfs_start_transaction(root, 3); 4825 trans = btrfs_start_transaction(root, 5);
4828 if (IS_ERR(trans)) { 4826 if (IS_ERR(trans)) {
4829 err = PTR_ERR(trans); 4827 err = PTR_ERR(trans);
4830 goto fail; 4828 goto fail;
@@ -6056,6 +6054,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
6056 if (!skip_sum) { 6054 if (!skip_sum) {
6057 dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); 6055 dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS);
6058 if (!dip->csums) { 6056 if (!dip->csums) {
6057 kfree(dip);
6059 ret = -ENOMEM; 6058 ret = -ENOMEM;
6060 goto free_ordered; 6059 goto free_ordered;
6061 } 6060 }