]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ocfs2/dlm: fix race between dispatched_work and dlm_lockres_grab_inflight_worker
authorJoseph Qi <joseph.qi@huawei.com>
Fri, 19 Dec 2014 00:17:34 +0000 (16:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Dec 2014 03:08:11 +0000 (19:08 -0800)
commit1e5895816030eaadb952c89eb9f4054e5c0082c3
tree00476a915aed960c74bef81f8541cc88eb2899e8
parentf62f12b3a426c8f65b10011b1ec40ba4277cbf5f
ocfs2/dlm: fix race between dispatched_work and dlm_lockres_grab_inflight_worker

Commit ac4fef4d23ed ("ocfs2/dlm: do not purge lockres that is queued for
assert master") may have the following possible race case:

  dlm_dispatch_assert_master       dlm_wq
  ========================================================================
  queue_work(dlm->quedlm_worker,
      &dlm->dispatched_work);
                                 dispatch work,
                                 dlm_lockres_drop_inflight_worker
                                 *BUG_ON(res->inflight_assert_workers == 0)*
  dlm_lockres_grab_inflight_worker
  inflight_assert_workers++

So ensure inflight_assert_workers to be increased first.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Signed-off-by: Xue jiufei <xuejiufei@huawei.com>
Cc: Joel Becker <jlbec@evilplan.org>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/dlm/dlmmaster.c