1. 16 Nov, 2017 1 commit
  2. 28 Feb, 2017 1 commit
  3. 14 Jan, 2017 1 commit
    • Peter Zijlstra's avatar
      locking/atomic, kref: Add kref_read() · 2c935bc5
      Peter Zijlstra authored
      Since we need to change the implementation, stop exposing internals.
      
      Provide kref_read() to read the current reference count; typically
      used for debug messages.
      
      Kills two anti-patterns:
      
      	atomic_read(&kref->refcount)
      	kref->refcount.counter
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
      2c935bc5
  4. 13 Dec, 2016 2 commits
  5. 11 Oct, 2016 1 commit
  6. 02 Aug, 2016 3 commits
  7. 29 Apr, 2016 1 commit
  8. 15 Mar, 2016 3 commits
    • Jiufei Xue's avatar
      ocfs2: fix a tiny race that leads file system read-only · 814ce694
      Jiufei Xue authored
      when o2hb detect a node down, it first set the dead node to recovery map
      and create ocfs2rec which will replay journal for dead node.  o2hb
      thread then call dlm_do_local_recovery_cleanup() to delete the lock for
      dead node.  After the lock of dead node is gone, locks for other nodes
      can be granted and may modify the meta data without replaying journal of
      the dead node.  The detail is described as follows.
      
           N1                         N2                   N3(master)
      modify the extent tree of
      inode, and commit
      dirty metadata to journal,
      then goes down.
                                                       o2hb thread detects
                                                       N1 goes down, set
                                                       recovery map and
                                                       delete the lock of N1.
      
                                                       dlm_thread flush ast
                                                       for the lock of N2.
                              do not detect the death
                              of N1, so recovery map is
                              empty.
      
                              read inode from disk
                              without replaying
                              the journal of N1 and
                              modify the extent tree
                              of the inode that N1
                              had modified.
                                                       ocfs2rec recover the
                                                       journal of N1.
                                                       The modification of N2
                                                       is lost.
      
      The modification of N1 and N2 are not serial, and it will lead to
      read-only file system.  We can set recovery_waiting flag to the lock
      resource after delete the lock for dead node to prevent other node from
      getting the lock before dlm recovery.  After dlm recovery, the recovery
      map on N2 is not empty, ocfs2_inode_lock_full_nested() will wait for ocfs2
      recovery.
      Signed-off-by: default avatarJiufei Xue <xuejiufei@huawei.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      814ce694
    • xuejiufei's avatar
      ocfs2/dlm: return in progress if master can not clear the refmap bit right now · 842b90b6
      xuejiufei authored
      Master returns in-progress to non-master node when it can not clear the
      refmap bit right now.  And non-master node will not purge the lock
      resource until receiving deref done message.
      Signed-off-by: default avatarxuejiufei <xuejiufei@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      842b90b6
    • xuejiufei's avatar
      ocfs2/dlm: add DEREF_DONE message · 60d663cb
      xuejiufei authored
      This series of patches is to fix the dis-order issue of setting/clearing
      refmap bit described below.
      
      Node 1                               Node 2(master)
      dlmlock
      dlm_do_master_request
                                      dlm_master_request_handler
                                      -> dlm_lockres_set_refmap_bit
      dlmlock succeed
      dlmunlock succeed
      
      dlm_purge_lockres
                                      dlm_deref_handler
                                      -> find lock resource is in
                                         DLM_LOCK_RES_SETREF_INPROG state,
                                         so dispatch a deref work
      dlm_purge_lockres succeed.
      
      call dlmlock again
      dlm_do_master_request
                                      dlm_master_request_handler
                                      -> dlm_lockres_set_refmap_bit
      
                                      deref work trigger, call
                                      dlm_lockres_clear_refmap_bit
                                      to clear Node 1 from refmap
      
                                      dlm_purge_lockres succeed
      
      dlm_send_remote_lock_request
                                      return DLM_IVLOCKID because
                                      the lockres is not exist
      BUG if the lockres is $RECOVERY
      
      This series of patches add a new message to keep the order of set and
      clear.  Other nodes can purge the lock resource only after the refmap bit
      on master is cleared.
      
      This patch is to add DEREF_DONE message and corresponding handler.  Node
      can purge the lock resource after receiving this message.  As a new
      message is added, so increase the minor number of dlm protocol version.
      Signed-off-by: default avatarxuejiufei <xuejiufei@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      60d663cb
  9. 15 Jan, 2016 4 commits
  10. 30 Dec, 2015 1 commit
    • xuejiufei's avatar
      ocfs2/dlm: clear migration_pending when migration target goes down · cc28d6d8
      xuejiufei authored
      We have found a BUG on res->migration_pending when migrating lock
      resources.  The situation is as follows.
      
      dlm_mark_lockres_migration
        res->migration_pending = 1;
        __dlm_lockres_reserve_ast
        dlm_lockres_release_ast returns with res->migration_pending remains
            because other threads reserve asts
        wait dlm_migration_can_proceed returns 1
        >>>>>>> o2hb found that target goes down and remove target
                from domain_map
        dlm_migration_can_proceed returns 1
        dlm_mark_lockres_migrating returns -ESHOTDOWN with
            res->migration_pending still remains.
      
      When reentering dlm_mark_lockres_migrating(), it will trigger the BUG_ON
      with res->migration_pending.  So clear migration_pending when target is
      down.
      Signed-off-by: default avatarJiufei Xue <xuejiufei@huawei.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cc28d6d8
  11. 23 Oct, 2015 1 commit
  12. 22 Sep, 2015 1 commit
    • Joseph Qi's avatar
      ocfs2/dlm: fix deadlock when dispatch assert master · 012572d4
      Joseph Qi authored
      The order of the following three spinlocks should be:
      dlm_domain_lock < dlm_ctxt->spinlock < dlm_lock_resource->spinlock
      
      But dlm_dispatch_assert_master() is called while holding
      dlm_ctxt->spinlock and dlm_lock_resource->spinlock, and then it calls
      dlm_grab() which will take dlm_domain_lock.
      
      Once another thread (for example, dlm_query_join_handler) has already
      taken dlm_domain_lock, and tries to take dlm_ctxt->spinlock deadlock
      happens.
      Signed-off-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: "Junxiao Bi" <junxiao.bi@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      012572d4
  13. 04 Sep, 2015 1 commit
  14. 06 May, 2015 1 commit
    • Junxiao Bi's avatar
      ocfs2: dlm: fix race between purge and get lock resource · b1432a2a
      Junxiao Bi authored
      There is a race window in dlm_get_lock_resource(), which may return a
      lock resource which has been purged.  This will cause the process to
      hang forever in dlmlock() as the ast msg can't be handled due to its
      lock resource not existing.
      
          dlm_get_lock_resource {
              ...
              spin_lock(&dlm->spinlock);
              tmpres = __dlm_lookup_lockres_full(dlm, lockid, namelen, hash);
              if (tmpres) {
                   spin_unlock(&dlm->spinlock);
                   >>>>>>>> race window, dlm_run_purge_list() may run and purge
                                    the lock resource
                   spin_lock(&tmpres->spinlock);
                   ...
                   spin_unlock(&tmpres->spinlock);
              }
          }
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Joseph Qi <joseph.qi@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1432a2a
  15. 19 Dec, 2014 1 commit
  16. 11 Dec, 2014 1 commit
    • Srinivas Eeda's avatar
      ocfs2: o2dlm: fix a race between purge and master query · cb79662b
      Srinivas Eeda authored
      Node A sends master query request to node B which is the master.  At this
      time lockres happens to be on purgelist.  dlm_master_request_handler gets
      the dlm spinlock, finds the resource and releases the dlm spin lock.
      Right at this dlm_thread on this node could purge the lockres.
      dlm_master_request_handler can then acquire lockres spinlock and reply to
      Node A that node B is the master even though lockres on node B is purged.
      
      The above scenario will now make node A falsely think node B is the master
      which is inconsistent.  Further if another node C tries to master the same
      resource, every node will respond they are not the master.  Node C then
      masters the resource and sends assert master to all nodes.  This will now
      make node A crash with the following message.
      
      dlm_assert_master_handler:1831 ERROR: DIE! Mastery assert from 9, but current
      owner is 10!
      Signed-off-by: default avatarSrinivas Eeda <srinivas.eeda@oracle.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Reviewed-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Tested-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb79662b
  17. 10 Oct, 2014 1 commit
  18. 02 Oct, 2014 1 commit
  19. 26 Sep, 2014 1 commit
  20. 07 Aug, 2014 1 commit
    • Tariq Saeed's avatar
      ocfs2: race between umount and unfinished remastering during recovery · bba1cb17
      Tariq Saeed authored
      Orabug: 19074140
      
      When umount is issued during recovery on the new master that has not
      finished remastering locks, it triggers BUG() in
      dlm_send_mig_lockres_msg().  Here is the situation:
      
       1) node A has a lock on resource X mastered by node B.
      
       2) node B dies ->  node A sets recovering flag for res X
      
       3) Node C becomes the new master for resources owned by the
          dead node and is remastering locks of the dead node but
          has not finished the remastering process yet.
      
       4) umount is issued on node C.
      
       5) During processing of umount, ignoring unfished recovery,
          node C attempts to migrate resource X to node A.
      
       6) node A finds res X in DLM_LOCK_RES_RECOVERING state, considers
          it a logic error and sends back -EFAULT.
      
       7) node C asserts BUG() upon seeing EFAULT resp from node B.
      
      Fix is to delay migrating res X till remastering is finished at which
      point recovering flag will be cleared on both A and C.
      Signed-off-by: default avatarTariq Saeed <tariq.x.saeed@oracle.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bba1cb17
  21. 23 Jun, 2014 2 commits
  22. 04 Jun, 2014 1 commit
  23. 23 May, 2014 1 commit
  24. 13 Nov, 2013 2 commits
  25. 11 Sep, 2013 1 commit
  26. 26 Feb, 2013 1 commit
  27. 24 Jul, 2011 3 commits
  28. 26 May, 2011 1 commit
    • Sunil Mushran's avatar
      ocfs2/dlm: Do not migrate resource to a node that is leaving the domain · 66effd3c
      Sunil Mushran authored
      During dlm domain shutdown, o2dlm has to free all the lock resources. Ones that
      have no locks and references are freed. Ones that have locks and/or references
      are migrated to another node.
      
      The first task in migration is finding a target. Currently we scan the lock
      resource and find one node that either has a lock or a reference. This is not
      very efficient in a parallel umount case as we might end up migrating the
      lock resource to a node which itself may have to migrate it to a third node.
      
      The patch scans the dlm->exit_domain_map to ensure the target node is not
      leaving the domain. If no valid target node is found, o2dlm does not migrate
      the resource but instead waits for the unlock and deref messages that will
      allow it to free the resource.
      Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
      66effd3c