mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Replace usage of schedule_timeout with schedule_timeout_interruptible (#16150)
This commit replaces current usages of schedule_timeout() with schedule_timeout_interruptible() in code paths that expect the running task to sleep for a short period of time. When schedule_timeout() is called without previously calling set_current_state(), the running task never sleeps because the task state remains in TASK_RUNNING. By calling schedule_timeout_interruptible() to set the task state to TASK_INTERRUPTIBLE before calling schedule_timeout() we achieve the intended/desired behavior of putting the task to sleep for the specified timeout. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Daniel Perry <dtperry@amazon.com> Closes #16150
This commit is contained in:
		
							parent
							
								
									deddfdd280
								
							
						
					
					
						commit
						05d6f621a9
					
				| @ -158,7 +158,7 @@ retry: | ||||
| 		 * throttling the task dispatch rate. | ||||
| 		 */ | ||||
| 		spin_unlock_irqrestore(&tq->tq_lock, *irqflags); | ||||
| 		schedule_timeout(HZ / 100); | ||||
| 		schedule_timeout_interruptible(HZ / 100); | ||||
| 		spin_lock_irqsave_nested(&tq->tq_lock, *irqflags, | ||||
| 		    tq->tq_lock_class); | ||||
| 		if (count < 100) { | ||||
|  | ||||
| @ -401,7 +401,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, | ||||
| 			if (v->vdev_removed) | ||||
| 				break; | ||||
| 
 | ||||
| 			schedule_timeout(MSEC_TO_TICK(10)); | ||||
| 			schedule_timeout_interruptible(MSEC_TO_TICK(10)); | ||||
| 		} else if (unlikely(BDH_PTR_ERR(bdh) == -ERESTARTSYS)) { | ||||
| 			timeout = MSEC2NSEC(zfs_vdev_open_timeout_ms * 10); | ||||
| 			continue; | ||||
|  | ||||
| @ -800,7 +800,8 @@ retry: | ||||
| 				if ((gethrtime() - start) > timeout) | ||||
| 					return (-SET_ERROR(ERESTARTSYS)); | ||||
| 
 | ||||
| 				schedule_timeout(MSEC_TO_TICK(10)); | ||||
| 				schedule_timeout_interruptible( | ||||
| 					MSEC_TO_TICK(10)); | ||||
| 				goto retry; | ||||
| #endif | ||||
| 			} else { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Perry
						Daniel Perry