summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-10-28 15:30:42 -0400
committerChris Mason <chris.mason@oracle.com>2010-10-29 11:25:46 -0400
commit18e503d695ff8ff9a43768555aa74575bf6b77f3 (patch)
treec17c34762dcf9988e9739ae0cdf5628885bf8828
parent19fe0a8b787d7c7f9318975b5a8c6e7e5e54e925 (diff)
downloadop-kernel-dev-18e503d695ff8ff9a43768555aa74575bf6b77f3.zip
op-kernel-dev-18e503d695ff8ff9a43768555aa74575bf6b77f3.tar.gz
Btrfs: fix raid code for removing missing drives
When btrfs is mounted in degraded mode, it has some internal structures to track the missing devices. This missing device is setup as readonly, but the mapping code can get upset when we try to write to it. This changes the mapping code to return -EIO instead of oops when we try to write to the readonly device. Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/volumes.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index dd318ff..28681e7 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3034,8 +3034,7 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
}
bio->bi_sector = multi->stripes[dev_nr].physical >> 9;
dev = multi->stripes[dev_nr].dev;
- BUG_ON(rw == WRITE && !dev->writeable);
- if (dev && dev->bdev) {
+ if (dev && dev->bdev && (rw != WRITE || dev->writeable)) {
bio->bi_bdev = dev->bdev;
if (async_submit)
schedule_bio(root, dev, rw, bio);
OpenPOWER on IntegriCloud