summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason2008-01-14 22:24:38 +0100
committerChris Mason2008-09-25 17:03:59 +0200
commit61295eb8665e723e77af91d0a1e655a4bd28344f (patch)
tree15e1f88cfa9faaaef85f9afd49f8860c069095a2 /fs/btrfs/inode.c
parentBtrfs: Delete any remaining extent_maps before freeing the inode (diff)
downloadkernel-qcow2-linux-61295eb8665e723e77af91d0a1e655a4bd28344f.tar.gz
kernel-qcow2-linux-61295eb8665e723e77af91d0a1e655a4bd28344f.tar.xz
kernel-qcow2-linux-61295eb8665e723e77af91d0a1e655a4bd28344f.zip
Btrfs: Add drop inode func to avoid data=ordered deadlock
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5260b4708158..e53d20331646 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -990,6 +990,25 @@ out:
fail:
return err;
}
+
+void btrfs_drop_inode(struct inode *inode)
+{
+ struct btrfs_trans_handle *trans;
+ struct btrfs_root *root = BTRFS_I(inode)->root;
+
+ if (!BTRFS_I(inode)->ordered_trans) {
+ generic_drop_inode(inode);
+ return;
+ }
+ /* nasty, but it prevents a deadlock with data=ordered by preventing
+ * a commit until after this inode is done
+ */
+ trans = btrfs_start_transaction(root, 1);
+ generic_drop_inode(inode);
+ /* note, the inode is now untouchable */
+ btrfs_end_transaction(trans, root);
+}
+
void btrfs_delete_inode(struct inode *inode)
{
struct btrfs_trans_handle *trans;