Skip to contentSkip to conversation

Btrfs: Treat -EDQUOT like -ENOSPC during unlink

RFC PATCH New [email protected] 1 participant 1 message Jun 3, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Btrfs: Treat -EDQUOT like -ENOSPC during unlink

From: Justin Maggard <[email protected]>

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(-)
fs/btrfs/inode.c +2 -2
index 742f65d..d247c2d 100644
@@ -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);
Signature · 1 line
2.4.2