Skip to content

Commit 7cfa9e5

Browse files
Miao XieJosef Bacik
authored andcommitted
Btrfs: don't abort the current transaction if there is no enough space for inode cache
The filesystem with inode cache was forced to be read-only when we umounted it. Steps to reproduce: # mkfs.btrfs -f ${DEV} # mount -o inode_cache ${DEV} ${MNT} # dd if=/dev/zero of=${MNT}/file1 bs=1M count=8192 # btrfs fi syn ${MNT} # dd if=${MNT}/file1 of=/dev/null bs=1M # rm -f ${MNT}/file1 # btrfs fi syn ${MNT} # umount ${MNT} It is because there was no enough space to do inode cache truncation, and then we aborted the current transaction. But no space error is not a serious problem when we write out the inode cache, and it is safe that we just skip this step if we meet this problem. So we need not abort the current transaction. Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
1 parent 8250dab commit 7cfa9e5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/btrfs/inode-map.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
468468
if (i_size_read(inode) > 0) {
469469
ret = btrfs_truncate_free_space_cache(root, trans, path, inode);
470470
if (ret) {
471-
btrfs_abort_transaction(trans, root, ret);
471+
if (ret != -ENOSPC)
472+
btrfs_abort_transaction(trans, root, ret);
472473
goto out_put;
473474
}
474475
}

0 commit comments

Comments
 (0)