* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: call d_instantiate after all ops are setup Btrfs: fix worker lock misuse in find_worker
Unified · Split
| @@ -563,8 +563,8 @@ static struct btrfs_worker_thread *find_worker(struct btrfs_workers *workers) · 562 unmodified lines | ||
| 563 | 563 | struct list_head *fallback; |
| 564 | 564 | int ret; |
| 565 | 565 | |
| 566 | −again: | |
| 567 | 566 | spin_lock_irqsave(&workers->lock, flags); |
| 567 | +again: | |
| 568 | 568 | worker = next_worker(workers); |
| 569 | 569 | |
| 570 | 570 | if (!worker) { |
| @@ -579,6 +579,7 @@ again: · 8 unmodified lines | ||
| 579 | 579 | spin_unlock_irqrestore(&workers->lock, flags); |
| 580 | 580 | /* we're below the limit, start another worker */ |
| 581 | 581 | ret = __btrfs_start_workers(workers); |
| 582 | + spin_lock_irqsave(&workers->lock, flags); | |
| 582 | 583 | if (ret) |
| 583 | 584 | goto fallback; |
| 584 | 585 | goto again; |
| @@ -4590,10 +4590,6 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans, · 4589 unmodified lines | ||
| 4590 | 4590 | int err = btrfs_add_link(trans, dir, inode, |
| 4591 | 4591 | dentry->d_name.name, dentry->d_name.len, |
| 4592 | 4592 | backref, index); |
| 4593 | − if (!err) { | |
| 4594 | − d_instantiate(dentry, inode); | |
| 4595 | − return 0; | |
| 4596 | − } | |
| 4597 | 4593 | if (err > 0) |
| 4598 | 4594 | err = -EEXIST; |
| 4599 | 4595 | return err; |
| @@ -4655,6 +4651,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, · 55 unmodified lines | ||
| 4655 | 4651 | else { |
| 4656 | 4652 | init_special_inode(inode, inode->i_mode, rdev); |
| 4657 | 4653 | btrfs_update_inode(trans, root, inode); |
| 4654 | + d_instantiate(dentry, inode); | |
| 4658 | 4655 | } |
| 4659 | 4656 | out_unlock: |
| 4660 | 4657 | nr = trans->blocks_used; |
| @@ -4722,6 +4719,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, · 61 unmodified lines | ||
| 4722 | 4719 | inode->i_mapping->a_ops = &btrfs_aops; |
| 4723 | 4720 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
| 4724 | 4721 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
| 4722 | + d_instantiate(dentry, inode); | |
| 4725 | 4723 | } |
| 4726 | 4724 | out_unlock: |
| 4727 | 4725 | nr = trans->blocks_used; |
| @@ -4779,6 +4777,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, · 51 unmodified lines | ||
| 4779 | 4777 | struct dentry *parent = dentry->d_parent; |
| 4780 | 4778 | err = btrfs_update_inode(trans, root, inode); |
| 4781 | 4779 | BUG_ON(err); |
| 4780 | + d_instantiate(dentry, inode); | |
| 4782 | 4781 | btrfs_log_new_name(trans, inode, NULL, parent); |
| 4783 | 4782 | } |
| 4784 | 4783 | |
| @@ -7245,6 +7244,8 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, · 2460 unmodified lines | ||
| 7245 | 7244 | drop_inode = 1; |
| 7246 | 7245 | |
| 7247 | 7246 | out_unlock: |
| 7247 | + if (!err) | |
| 7248 | + d_instantiate(dentry, inode); | |
| 7248 | 7249 | nr = trans->blocks_used; |
| 7249 | 7250 | btrfs_end_transaction_throttle(trans, root); |
| 7250 | 7251 | if (drop_inode) { |