diff options
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 1782023bd68a..0e04142d5962 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -544,6 +544,7 @@ static inline int dio_bio_reap(struct dio *dio, struct dio_submit *sdio) | |||
544 | */ | 544 | */ |
545 | static int sb_init_dio_done_wq(struct super_block *sb) | 545 | static int sb_init_dio_done_wq(struct super_block *sb) |
546 | { | 546 | { |
547 | struct workqueue_struct *old; | ||
547 | struct workqueue_struct *wq = alloc_workqueue("dio/%s", | 548 | struct workqueue_struct *wq = alloc_workqueue("dio/%s", |
548 | WQ_MEM_RECLAIM, 0, | 549 | WQ_MEM_RECLAIM, 0, |
549 | sb->s_id); | 550 | sb->s_id); |
@@ -552,9 +553,9 @@ static int sb_init_dio_done_wq(struct super_block *sb) | |||
552 | /* | 553 | /* |
553 | * This has to be atomic as more DIOs can race to create the workqueue | 554 | * This has to be atomic as more DIOs can race to create the workqueue |
554 | */ | 555 | */ |
555 | cmpxchg(&sb->s_dio_done_wq, NULL, wq); | 556 | old = cmpxchg(&sb->s_dio_done_wq, NULL, wq); |
556 | /* Someone created workqueue before us? Free ours... */ | 557 | /* Someone created workqueue before us? Free ours... */ |
557 | if (wq != sb->s_dio_done_wq) | 558 | if (old) |
558 | destroy_workqueue(wq); | 559 | destroy_workqueue(wq); |
559 | return 0; | 560 | return 0; |
560 | } | 561 | } |