mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
lightnvm: pblk: prevent premature sync point resets
Unless we protect flush pointer updates with a lock, we risk resetting new flush points before we've synced all sectors up to that point. This patch protects new flush points with the same spin lock that is being held when advancing the sync pointer and resetting completed flush points. Signed-off-by: Hans Holmberg <[email protected]> Signed-off-by: Javier González <[email protected]> Signed-off-by: Matias Bjørling <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
533657c190
commit
b36bbf9d4f
1 changed files with 6 additions and 6 deletions
|
|
@ -367,17 +367,17 @@ static int pblk_rb_flush_point_set(struct pblk_rb *rb, struct bio *bio,
|
|||
flush_point = (pos == 0) ? (rb->nr_entries - 1) : (pos - 1);
|
||||
entry = &rb->entries[flush_point];
|
||||
|
||||
pblk_rb_sync_init(rb, NULL);
|
||||
|
||||
/* Protect flush points */
|
||||
smp_store_release(&rb->flush_point, flush_point);
|
||||
|
||||
if (!bio)
|
||||
return 0;
|
||||
if (bio)
|
||||
bio_list_add(&entry->w_ctx.bios, bio);
|
||||
|
||||
spin_lock_irq(&rb->s_lock);
|
||||
bio_list_add(&entry->w_ctx.bios, bio);
|
||||
spin_unlock_irq(&rb->s_lock);
|
||||
pblk_rb_sync_end(rb, NULL);
|
||||
|
||||
return 1;
|
||||
return bio ? 1 : 0;
|
||||
}
|
||||
|
||||
static int __pblk_rb_may_write(struct pblk_rb *rb, unsigned int nr_entries,
|
||||
|
|
|
|||
Loading…
Reference in a new issue