+ ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: ocfs2/dlm: don't handle migrate lockres if already in shutdown
has been added to the -mm tree.  Its filename is
     ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Jun Piao <piaojun@xxxxxxxxxx>
Subject: ocfs2/dlm: don't handle migrate lockres if already in shutdown

We should not handle migrate lockres if we are already in
'DLM_CTXT_IN_SHUTDOWN', as that will cause lockres remains after leaving
dlm domain.  At last other nodes will get stuck into infinite loop when
requsting lock from us.

The problem is caused by concurrency umount between nodes.  Before
receiveing N1's DLM_BEGIN_EXIT_DOMAIN_MSG, N2 has picked up N1 as the
migrate target.  So N2 will continue sending lockres to N1 even though N1
has left domain.

    N1                             N2 (owner)
                                   touch file

access the file,
and get pr lock

                                   begin leave domain and
                                   pick up N1 as new owner

begin leave domain and
migrate all lockres done

                                   begin migrate lockres to N1

end leave domain, but
the lockres left
unexpectedly, because
migrate task has passed

Link: http://lkml.kernel.org/r/5A99F028.2090902@xxxxxxxxxx
Signed-off-by: Jun Piao <piaojun@xxxxxxxxxx>
Reviewed-by: Yiwen Jiang <jiangyiwen@xxxxxxxxxx>
Cc: Mark Fasheh <mfasheh@xxxxxxxxxxx>
Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx>
Cc: Joseph Qi <jiangqi903@xxxxxxxxx>
Cc: Changwei Ge <ge.changwei@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/ocfs2/dlm/dlmdomain.c   |   14 ++++++++++++++
 fs/ocfs2/dlm/dlmdomain.h   |    1 +
 fs/ocfs2/dlm/dlmrecovery.c |    9 +++++++++
 3 files changed, 24 insertions(+)

diff -puN fs/ocfs2/dlm/dlmdomain.c~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown fs/ocfs2/dlm/dlmdomain.c
--- a/fs/ocfs2/dlm/dlmdomain.c~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown
+++ a/fs/ocfs2/dlm/dlmdomain.c
@@ -675,6 +675,20 @@ static void dlm_leave_domain(struct dlm_
 	spin_unlock(&dlm->spinlock);
 }
 
+int dlm_joined(struct dlm_ctxt *dlm)
+{
+	int ret = 0;
+
+	spin_lock(&dlm_domain_lock);
+
+	if (dlm->dlm_state == DLM_CTXT_JOINED)
+		ret = 1;
+
+	spin_unlock(&dlm_domain_lock);
+
+	return ret;
+}
+
 int dlm_shutting_down(struct dlm_ctxt *dlm)
 {
 	int ret = 0;
diff -puN fs/ocfs2/dlm/dlmdomain.h~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown fs/ocfs2/dlm/dlmdomain.h
--- a/fs/ocfs2/dlm/dlmdomain.h~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown
+++ a/fs/ocfs2/dlm/dlmdomain.h
@@ -28,6 +28,7 @@
 extern spinlock_t dlm_domain_lock;
 extern struct list_head dlm_domains;
 
+int dlm_joined(struct dlm_ctxt *dlm);
 int dlm_shutting_down(struct dlm_ctxt *dlm);
 void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm,
 					int node_num);
diff -puN fs/ocfs2/dlm/dlmrecovery.c~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown fs/ocfs2/dlm/dlmrecovery.c
--- a/fs/ocfs2/dlm/dlmrecovery.c~ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown
+++ a/fs/ocfs2/dlm/dlmrecovery.c
@@ -1378,6 +1378,15 @@ int dlm_mig_lockres_handler(struct o2net
 	if (!dlm_grab(dlm))
 		return -EINVAL;
 
+	if (!dlm_joined(dlm)) {
+		mlog(ML_ERROR, "Domain %s not joined! "
+			  "lockres %.*s, master %u\n",
+			  dlm->name, mres->lockname_len,
+			  mres->lockname, mres->master);
+		dlm_put(dlm);
+		return -EINVAL;
+	}
+
 	BUG_ON(!(mres->flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION)));
 
 	real_master = mres->master;
_

Patches currently in -mm which might be from piaojun@xxxxxxxxxx are

ocfs2-use-osb-instead-of-ocfs2_sb.patch
ocfs2-use-oi-instead-of-ocfs2_i.patch
ocfs2-clean-up-some-unused-function-declaration.patch
ocfs2-dlm-dont-handle-migrate-lockres-if-already-in-shutdown.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux