X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=fs%2Fdirect-io.c;h=0e04142d5962312fcb055738479247b2364a252e;hb=509bf24d1810f120cb1e07cb2d30360a79601f71;hp=1782023bd68a6655d6def2258263d22080c06c33;hpb=d75671e36e14b73d7c0d3cec49328dcd984af699;p=~andy%2Flinux diff --git a/fs/direct-io.c b/fs/direct-io.c index 1782023bd68..0e04142d596 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) */ static int sb_init_dio_done_wq(struct super_block *sb) { + struct workqueue_struct *old; struct workqueue_struct *wq = alloc_workqueue("dio/%s", WQ_MEM_RECLAIM, 0, sb->s_id); @@ -552,9 +553,9 @@ static int sb_init_dio_done_wq(struct super_block *sb) /* * This has to be atomic as more DIOs can race to create the workqueue */ - cmpxchg(&sb->s_dio_done_wq, NULL, wq); + old = cmpxchg(&sb->s_dio_done_wq, NULL, wq); /* Someone created workqueue before us? Free ours... */ - if (wq != sb->s_dio_done_wq) + if (old) destroy_workqueue(wq); return 0; }