summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-03-04 20:09:46 +0100
committerJosef Bacik <josef@redhat.com>2011-03-17 19:21:28 +0100
commitded5db9de78f963979e1605f859de67626f54693 (patch)
treed52b91b659b22f5f24ba8b8bf42a3a829e335010 /fs/btrfs
parentBtrfs: handle errors in btrfs_orphan_cleanup (diff)
downloadlinux-ded5db9de78f963979e1605f859de67626f54693.tar.xz
linux-ded5db9de78f963979e1605f859de67626f54693.zip
Btrfs: make sure to remove the orphan item from the in-memory list
This fixes a problem where if truncate fails the inode will still be on the in memory orphan list. This is will make us complain when the inode gets destroyed because it's still on the orphan list. So if we fail just remove us from the in memory list and carry on. Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0600265cb9b0..3bd0ff63bf30 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6589,6 +6589,12 @@ static int btrfs_truncate(struct inode *inode)
ret = btrfs_orphan_del(trans, inode);
if (ret)
err = ret;
+ } else if (ret && inode->i_nlink > 0) {
+ /*
+ * Failed to do the truncate, remove us from the in memory
+ * orphan list.
+ */
+ ret = btrfs_orphan_del(NULL, inode);
}
ret = btrfs_update_inode(trans, root, inode);