]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: make sure reserve_metadata_bytes doesn't leak out strange errors
authorChris Mason <chris.mason@oracle.com>
Wed, 27 Jul 2011 19:57:44 +0000 (15:57 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 27 Jul 2011 20:11:41 +0000 (16:11 -0400)
The btrfs transaction code will return any errors that come from
reserve_metadata_bytes.  We need to make sure we don't return funny
things like 1 or EAGAIN.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index 06a5ee29b4463b24f80adac8e70928c0a9fe5903..4d08ed79405d2c5729fd78d45c75a02f4e556687 100644 (file)
@@ -3474,6 +3474,8 @@ again:
        if (ret < 0)
                goto out;
 
+       ret = 0;
+
        /*
         * So if we were overcommitted it's possible that somebody else flushed
         * out enough space and we simply didn't have enough space to reclaim,
@@ -3496,10 +3498,13 @@ again:
                goto out;
 
        ret = -EAGAIN;
-       if (trans || committed)
+       if (trans)
                goto out;
 
        ret = -ENOSPC;
+       if (committed)
+               goto out;
+
        trans = btrfs_join_transaction(root);
        if (IS_ERR(trans))
                goto out;