Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274631
b: refs/heads/master
c: a8c9e57
h: refs/heads/master
i:
  274629: ab209a6
  274627: ea3fee2
  274623: cc2ada4
v: v3
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent 93c3f42 commit 8a9710c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b16a4e3c355ee3c790473decfcf83d4faeb8ce0
refs/heads/master: a8c9e5769718d47e87cce40c9b84cab421804797
36 changes: 17 additions & 19 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2285,37 +2285,35 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
found_key.type = BTRFS_INODE_ITEM_KEY;
found_key.offset = 0;
inode = btrfs_iget(root->fs_info->sb, &found_key, root, NULL);
if (IS_ERR(inode)) {
ret = PTR_ERR(inode);
ret = PTR_RET(inode);
if (ret && ret != -ESTALE)
goto out;
}

/*
* add this inode to the orphan list so btrfs_orphan_del does
* the proper thing when we hit it
*/
spin_lock(&root->orphan_lock);
list_add(&BTRFS_I(inode)->i_orphan, &root->orphan_list);
spin_unlock(&root->orphan_lock);

/*
* if this is a bad inode, means we actually succeeded in
* removing the inode, but not the orphan record, which means
* we need to manually delete the orphan since iput will just
* do a destroy_inode
* Inode is already gone but the orphan item is still there,
* kill the orphan item.
*/
if (is_bad_inode(inode)) {
trans = btrfs_start_transaction(root, 0);
if (ret == -ESTALE) {
trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
goto out;
}
btrfs_orphan_del(trans, inode);
ret = btrfs_del_orphan_item(trans, root,
found_key.objectid);
BUG_ON(ret);
btrfs_end_transaction(trans, root);
iput(inode);
continue;
}

/*
* add this inode to the orphan list so btrfs_orphan_del does
* the proper thing when we hit it
*/
spin_lock(&root->orphan_lock);
list_add(&BTRFS_I(inode)->i_orphan, &root->orphan_list);
spin_unlock(&root->orphan_lock);

/* if we have links, this was a truncate, lets do that */
if (inode->i_nlink) {
if (!S_ISREG(inode->i_mode)) {
Expand Down

0 comments on commit 8a9710c

Please sign in to comment.