Selaa lähdekoodia

Btrfs: do not abort transaction in prealloc case

During disk balance, we prealloc new file extent for file data relocation,
but we may fail in 'no available space' case, and it leads to flipping btrfs
into readonly.

It is not necessary to bail out and abort transaction since we do have several
ways to rescue ourselves from ENOSPC case.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Liu Bo 13 vuotta sitten
vanhempi
commit
0678938423
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. 5 1
      fs/btrfs/extent-tree.c

+ 5 - 1
fs/btrfs/extent-tree.c

@@ -5748,7 +5748,11 @@ loop:
 				ret = do_chunk_alloc(trans, root, num_bytes +
 						     2 * 1024 * 1024, data,
 						     CHUNK_ALLOC_LIMITED);
-				if (ret < 0) {
+				/*
+				 * Do not bail out on ENOSPC since we
+				 * can do more things.
+				 */
+				if (ret < 0 && ret != -ENOSPC) {
 					btrfs_abort_transaction(trans,
 								root, ret);
 					goto out;