浏览代码

ocfs2_dlm: Add missing locks in dlm_empty_lockres

__dlm_lockres_unused() expects the caller to take the lockres spinlock.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Sunil Mushran 18 年之前
父节点
当前提交
b36c3f8498
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      fs/ocfs2/dlm/dlmmaster.c

+ 3 - 0
fs/ocfs2/dlm/dlmmaster.c

@@ -2730,14 +2730,17 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
 	int ret;
 	int ret;
 	int lock_dropped = 0;
 	int lock_dropped = 0;
 
 
+	spin_lock(&res->spinlock);
 	if (res->owner != dlm->node_num) {
 	if (res->owner != dlm->node_num) {
 		if (!__dlm_lockres_unused(res)) {
 		if (!__dlm_lockres_unused(res)) {
 			mlog(ML_ERROR, "%s:%.*s: this node is not master, "
 			mlog(ML_ERROR, "%s:%.*s: this node is not master, "
 			     "trying to free this but locks remain\n",
 			     "trying to free this but locks remain\n",
 			     dlm->name, res->lockname.len, res->lockname.name);
 			     dlm->name, res->lockname.len, res->lockname.name);
 		}
 		}
+		spin_unlock(&res->spinlock);
 		goto leave;
 		goto leave;
 	}
 	}
+	spin_unlock(&res->spinlock);
 
 
 	/* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
 	/* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
 	spin_unlock(&dlm->spinlock);
 	spin_unlock(&dlm->spinlock);