From: Justin Maggard <jmaggar...@gmail.com>

Error messages saying, basically, "you don't have enough
free space to free up space" make people angry.

Sure, there are workarounds like truncating a file before
removing it; but it's certainly not obvious.  Unlink has a
special case if we cannot make our reservations the normal
way to try and see if there is enough slack room in the
global reserve to migrate.  Use the same retry for -EDQUOT.

There are certainly other (probably more proper) ways to
address this, but this is the least intrusive way that I
could think of.
---
 fs/btrfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 742f65d..d247c2d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4000,10 +4000,10 @@ static struct btrfs_trans_handle 
*__unlink_start_trans(struct inode *dir)
         * 1 for the inode
         */
        trans = btrfs_start_transaction(root, 5);
-       if (!IS_ERR(trans) || PTR_ERR(trans) != -ENOSPC)
+       if (!IS_ERR(trans) || (PTR_ERR(trans) != -ENOSPC && PTR_ERR(trans) != 
-EDQUOT))
                return trans;
 
-       if (PTR_ERR(trans) == -ENOSPC) {
+       if (PTR_ERR(trans) == -ENOSPC || PTR_ERR(trans) == -EDQUOT) {
                u64 num_bytes = btrfs_calc_trans_metadata_size(root, 5);
 
                trans = btrfs_start_transaction(root, 0);
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to