diff options
| author | Josef Bacik <josef@redhat.com> | 2010-01-26 21:07:59 -0500 |
|---|---|---|
| committer | Chris Mason <chris.mason@oracle.com> | 2010-01-28 16:20:39 -0500 |
| commit | f48b90756bd834dda852ff514f2690d3175b1f44 (patch) | |
| tree | 071f502edbe6668f9451d676ae3a0f751da5e105 | |
| parent | e3acc2a6850efff647f1c5458524eb3a8bcba20a (diff) | |
Btrfs: do not mark the chunk as readonly if in degraded mode
If a RAID setup has chunks that span multiple disks, and one of those
disks has failed, btrfs_chunk_readonly will return 1 since one of the
disks in that chunk's stripes is dead and therefore not writeable. So
instead if we are in degraded mode, return 0 so we can go ahead and
allocate stuff. Without this patch all of the block groups in a RAID1
setup will end up read-only, which will mean we can't add new disks to
the array since we won't be able to make allocations.
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
| -rw-r--r-- | fs/btrfs/volumes.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 220dad5db017..66122bdf8bbf 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -2538,6 +2538,11 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) | |||
| 2538 | if (!em) | 2538 | if (!em) |
| 2539 | return 1; | 2539 | return 1; |
| 2540 | 2540 | ||
| 2541 | if (btrfs_test_opt(root, DEGRADED)) { | ||
| 2542 | free_extent_map(em); | ||
| 2543 | return 0; | ||
| 2544 | } | ||
| 2545 | |||
| 2541 | map = (struct map_lookup *)em->bdev; | 2546 | map = (struct map_lookup *)em->bdev; |
| 2542 | for (i = 0; i < map->num_stripes; i++) { | 2547 | for (i = 0; i < map->num_stripes; i++) { |
| 2543 | if (!map->stripes[i].dev->writeable) { | 2548 | if (!map->stripes[i].dev->writeable) { |
