|
@@ -2986,7 +2986,10 @@ static int write_dev_supers(struct btrfs_device *device,
|
|
|
if (wait) {
|
|
|
bh = __find_get_block(device->bdev, bytenr / 4096,
|
|
|
BTRFS_SUPER_INFO_SIZE);
|
|
|
- BUG_ON(!bh);
|
|
|
+ if (!bh) {
|
|
|
+ errors++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
wait_on_buffer(bh);
|
|
|
if (!buffer_uptodate(bh))
|
|
|
errors++;
|
|
@@ -3013,6 +3016,13 @@ static int write_dev_supers(struct btrfs_device *device,
|
|
|
*/
|
|
|
bh = __getblk(device->bdev, bytenr / 4096,
|
|
|
BTRFS_SUPER_INFO_SIZE);
|
|
|
+ if (!bh) {
|
|
|
+ printk(KERN_ERR "btrfs: couldn't get super "
|
|
|
+ "buffer head for bytenr %Lu\n", bytenr);
|
|
|
+ errors++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
memcpy(bh->b_data, sb, BTRFS_SUPER_INFO_SIZE);
|
|
|
|
|
|
/* one reference for submit_bh */
|