All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Can't grow size twice for a super1.0 array
@ 2020-06-30  7:55 Xiao Ni
  2020-06-30  7:55 ` [PATCH 1/2] super1.0 calculates max sectors in a wrong way Xiao Ni
  2020-06-30  7:55 ` [PATCH 2/2] Don't need to reset superblock start address for super1.0 Xiao Ni
  0 siblings, 2 replies; 8+ messages in thread
From: Xiao Ni @ 2020-06-30  7:55 UTC (permalink / raw)
  To: linux-raid; +Cc: song, ncroxon

Hi all

This are the test steps:
[root@storageqe-54 ~]# mdadm -CR /dev/md0 -l1 -n2 /dev/loop0 /dev/loop1 -e 1.0 --size=1G
[root@storageqe-54 ~]# mdadm --wait /dev/md0
[root@storageqe-54 ~]# mdadm -G /dev/md0 --size=5G
mdadm: component size of /dev/md0 has been set to 5242880K
[root@storageqe-54 ~]# mdadm --wait /dev/md0
[root@storageqe-54 ~]# mdadm -G /dev/md0 --size=6G
mdadm: Cannot set device size for /dev/md0: No space left on device

loop0                                    7:0    0   7.8G  0 loop  
└─md0                                    9:0    0     5G  0 raid1 
loop1                                    7:1    0   7.8G  0 loop  
└─md0                                    9:0    0     5G  0 raid1 

The reason is that it calcluates the max usable space in a wrong way for super1.0 array.
It uses rdev->sectors to calcuate the max usable space rather than the whole disk size.
At first it grow size and it's successful. Because rdev->sectors is set to the whole disk
size when creating raid device. super_1_load sets rdev->sectors to sb->data_size. In mdadm
it sets sb->data_size to the whole disk size rathan than the raid device size. I think it's
a wrong place too. Because of this error, it can grow size successfully at the first time.

It re-sets rdev->sectors to real raid device after reshaping to the new size. So it can't
grow size anymore.

Xiao Ni (2):
  super1.0 calculates max sectors in a wrong way
  Don't need to reset superblock start address for super1.0

 drivers/md/md.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

-- 
2.7.5

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-29  2:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30  7:55 [PATCH 0/2] Can't grow size twice for a super1.0 array Xiao Ni
2020-06-30  7:55 ` [PATCH 1/2] super1.0 calculates max sectors in a wrong way Xiao Ni
2020-07-27 17:33   ` Song Liu
2020-07-28  1:18     ` Xiao Ni
2020-07-29  0:43       ` Song Liu
2020-07-29  1:13         ` Xiao Ni
2020-07-29  2:51           ` Song Liu
2020-06-30  7:55 ` [PATCH 2/2] Don't need to reset superblock start address for super1.0 Xiao Ni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.