mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	dm raid: fix raid_resume() to keep raid set frozen as needed
During a reshape request: if userspace reloads a "raid" table multiple times, resulting in multiple superblock reads, the raid set needs to stay frozen until all config changes (chunk size, layout data_offset, delta_disks) have been stored in the superblocks and respective flags cleared. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
		
							parent
							
								
									188a212df1
								
							
						
					
					
						commit
						d39f0010e4
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -3899,7 +3899,7 @@ static int raid_preresume(struct dm_target *ti)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Check for any reshape request unless new raid set */
 | 
						/* Check for any reshape request unless new raid set */
 | 
				
			||||||
	if (test_and_clear_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
 | 
						if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
 | 
				
			||||||
		/* Initiate a reshape. */
 | 
							/* Initiate a reshape. */
 | 
				
			||||||
		rs_set_rdev_sectors(rs);
 | 
							rs_set_rdev_sectors(rs);
 | 
				
			||||||
		mddev_lock_nointr(mddev);
 | 
							mddev_lock_nointr(mddev);
 | 
				
			||||||
| 
						 | 
					@ -3941,8 +3941,14 @@ static void raid_resume(struct dm_target *ti)
 | 
				
			||||||
	 * This ensures that the constructor for the inactive table
 | 
						 * This ensures that the constructor for the inactive table
 | 
				
			||||||
	 * retrieves an up-to-date reshape_position.
 | 
						 * retrieves an up-to-date reshape_position.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (!(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS))
 | 
						if (!test_and_clear_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags) &&
 | 
				
			||||||
		clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 | 
						    !(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS)) {
 | 
				
			||||||
 | 
							if (rs_is_reshapable(rs)) {
 | 
				
			||||||
 | 
								if (!rs_is_reshaping(rs) || _get_reshape_sectors(rs))
 | 
				
			||||||
 | 
									clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 | 
				
			||||||
 | 
							} else
 | 
				
			||||||
 | 
								clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
 | 
						if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
 | 
				
			||||||
		mddev_lock_nointr(mddev);
 | 
							mddev_lock_nointr(mddev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue