diff options
Diffstat (limited to 'drivers/md/dm-kcopyd.c')
| -rw-r--r-- | drivers/md/dm-kcopyd.c | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index cf2c67e35eaf..e6e7c686646d 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -107,7 +107,7 @@ static void io_job_start(struct dm_kcopyd_throttle *t)  try_again:  	spin_lock_irq(&throttle_spinlock); -	throttle = ACCESS_ONCE(t->throttle); +	throttle = READ_ONCE(t->throttle);  	if (likely(throttle >= 100))  		goto skip_limit; @@ -157,7 +157,7 @@ static void io_job_finish(struct dm_kcopyd_throttle *t)  	t->num_io_jobs--; -	if (likely(ACCESS_ONCE(t->throttle) >= 100)) +	if (likely(READ_ONCE(t->throttle) >= 100))  		goto skip_limit;  	if (!t->num_io_jobs) { @@ -477,8 +477,10 @@ static int run_complete_job(struct kcopyd_job *job)  	 * If this is the master job, the sub jobs have already  	 * completed so we can free everything.  	 */ -	if (job->master_job == job) +	if (job->master_job == job) { +		mutex_destroy(&job->lock);  		mempool_free(job, kc->job_pool); +	}  	fn(read_err, write_err, context);  	if (atomic_dec_and_test(&kc->nr_jobs)) @@ -750,6 +752,7 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,  	 * followed by SPLIT_COUNT sub jobs.  	 */  	job = mempool_alloc(kc->job_pool, GFP_NOIO); +	mutex_init(&job->lock);  	/*  	 * set up for the read. @@ -811,7 +814,6 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,  	if (job->source.count <= SUB_JOB_SIZE)  		dispatch_job(job);  	else { -		mutex_init(&job->lock);  		job->progress = 0;  		split_job(job);  	} | 
