.. | .. |
---|
3559 | 3559 | ret = btrfs_inc_block_group_ro(cache, sctx->is_dev_replace); |
---|
3560 | 3560 | if (ret == 0) { |
---|
3561 | 3561 | ro_set = 1; |
---|
3562 | | - } else if (ret == -ENOSPC && !sctx->is_dev_replace) { |
---|
| 3562 | + } else if (ret == -ENOSPC && !sctx->is_dev_replace && |
---|
| 3563 | + !(cache->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)) { |
---|
3563 | 3564 | /* |
---|
3564 | 3565 | * btrfs_inc_block_group_ro return -ENOSPC when it |
---|
3565 | 3566 | * failed in creating new chunk for metadata. |
---|
3566 | 3567 | * It is not a problem for scrub, because |
---|
3567 | 3568 | * metadata are always cowed, and our scrub paused |
---|
3568 | 3569 | * commit_transactions. |
---|
| 3570 | + * |
---|
| 3571 | + * For RAID56 chunks, we have to mark them read-only |
---|
| 3572 | + * for scrub, as later we would use our own cache |
---|
| 3573 | + * out of RAID56 realm. |
---|
| 3574 | + * Thus we want the RAID56 bg to be marked RO to |
---|
| 3575 | + * prevent RMW from screwing up out cache. |
---|
3569 | 3576 | */ |
---|
3570 | 3577 | ro_set = 0; |
---|
3571 | 3578 | } else if (ret == -ETXTBSY) { |
---|