Re: BUG drivers/md/md.c: data-offset reshape renders array unloadable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 24, 2015 at 11:23 PM, Wesley W. Terpstra <wesley@xxxxxxxxxxx> wrote:
>> First, it is obviously the last test in super_1_load that is rejecting
>> the array. The superblock reports more sectors than are calculated, so
>> the check
>>         if (sectors < le64_to_cpu(sb->data_size)) {
>> fails.
>
> Thus, an alternative explanation could be that the the sb->data_size
> was not updated after the reshape completed.

I can confirm that this was the problem.

I manually modified my super block using the attached quick hack.
Thereafter I was able to reassemble the array and fsck everything
successfully.

I will try and see if I can reproduce the problem tomorrow. It's a
pretty nasty bug to have a reshape complete and render your array
unassemblable.
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

int main() {
  char buf[512];
  uint64_t data_offset, data_size, reshape_position;
  uint32_t checksum;
  
  fread(buf, sizeof(buf), 1, stdin);
  
  /* Assumes little-endian */
  memcpy(&reshape_position, buf+0x68, 8);
  memcpy(&data_offset, buf+0x80, 8);
  memcpy(&data_size,   buf+0x88, 8);
  memcpy(&checksum,    buf+0xD8, 4);
  
  fprintf(stderr, "data_offset: %"PRIu64"\n", data_offset);
  fprintf(stderr, "data_size:   %"PRIu64"\n", data_size);
  fprintf(stderr, "reshape:     %"PRIu64"\n", reshape_position);
  fprintf(stderr, "checksum:    %x\n", checksum);
  
  /* Assumes no overflow */
  checksum += (5842894848 - data_size);
  data_size = 5842894848;
  
  memcpy(buf+0x88, &data_size, 8);
  memcpy(buf+0xD8, &checksum,  4);
   
  fwrite(buf, sizeof(buf), 1, stdout);
  
  return 0;
}

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux