aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@huawei.com>2014-12-10 18:41:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:03 -0500
commitf08736bd6c54c33b91d4324eee5713ca6f13319a (patch)
tree3bc3b44ce5e8a8d48af345ebb1748b4a598a212b /fs/ocfs2
parentded00142740f54610b7e256201c45a3bfa5f14e5 (diff)
ocfs2/dlm: let sender retry if dlm_dispatch_assert_master failed with -ENOMEM
Do not BUG() if GFP_ATOMIC allocation fails in dlm_dispatch_assert_master. Instead, return -ENOMEM to the sender and then retry. Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Reviewed-by: Alex Chen <alex.chen@huawei.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 3365839d2971..79b5af5e6a7b 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1656,14 +1656,18 @@ int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
1656 req.namelen = res->lockname.len; 1656 req.namelen = res->lockname.len;
1657 memcpy(req.name, res->lockname.name, res->lockname.len); 1657 memcpy(req.name, res->lockname.name, res->lockname.len);
1658 1658
1659resend:
1659 ret = o2net_send_message(DLM_MASTER_REQUERY_MSG, dlm->key, 1660 ret = o2net_send_message(DLM_MASTER_REQUERY_MSG, dlm->key,
1660 &req, sizeof(req), nodenum, &status); 1661 &req, sizeof(req), nodenum, &status);
1661 /* XXX: negative status not handled properly here. */
1662 if (ret < 0) 1662 if (ret < 0)
1663 mlog(ML_ERROR, "Error %d when sending message %u (key " 1663 mlog(ML_ERROR, "Error %d when sending message %u (key "
1664 "0x%x) to node %u\n", ret, DLM_MASTER_REQUERY_MSG, 1664 "0x%x) to node %u\n", ret, DLM_MASTER_REQUERY_MSG,
1665 dlm->key, nodenum); 1665 dlm->key, nodenum);
1666 else { 1666 else if (status == -ENOMEM) {
1667 mlog_errno(status);
1668 msleep(50);
1669 goto resend;
1670 } else {
1667 BUG_ON(status < 0); 1671 BUG_ON(status < 0);
1668 BUG_ON(status > DLM_LOCK_RES_OWNER_UNKNOWN); 1672 BUG_ON(status > DLM_LOCK_RES_OWNER_UNKNOWN);
1669 *real_master = (u8) (status & 0xff); 1673 *real_master = (u8) (status & 0xff);
@@ -1705,9 +1709,13 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data,
1705 int ret = dlm_dispatch_assert_master(dlm, res, 1709 int ret = dlm_dispatch_assert_master(dlm, res,
1706 0, 0, flags); 1710 0, 0, flags);
1707 if (ret < 0) { 1711 if (ret < 0) {
1708 mlog_errno(-ENOMEM); 1712 mlog_errno(ret);
1709 /* retry!? */ 1713 spin_unlock(&res->spinlock);
1710 BUG(); 1714 dlm_lockres_put(res);
1715 spin_unlock(&dlm->spinlock);
1716 dlm_put(dlm);
1717 /* sender will take care of this and retry */
1718 return ret;
1711 } else 1719 } else
1712 __dlm_lockres_grab_inflight_worker(dlm, res); 1720 __dlm_lockres_grab_inflight_worker(dlm, res);
1713 spin_unlock(&res->spinlock); 1721 spin_unlock(&res->spinlock);