Commit af23fd93 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull dlm updates from David Teigland:
 "This includes several minor code cleanups, and one notable fix for
  recovery of in-progress lock conversions which would lead to a the
  convert operation never completing"

* tag 'dlm-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
  dlm: Avoid -Wflex-array-member-not-at-end warning
  fs/dlm/dir: remove unuse variable count_match
  dlm: Constify struct configfs_item_operations and configfs_group_operations
  fs/dlm: use list_add_tail() instead of open-coding list insertion
  dlm: validate length in dlm_search_rsb_tree
  dlm: fix recovery pending middle conversion
parents 7141433f 2c3a0b73
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -324,39 +324,39 @@ struct dlm_member_gone {
	struct list_head list; /* space->members_gone */
};

static struct configfs_group_operations clusters_ops = {
static const struct configfs_group_operations clusters_ops = {
	.make_group = make_cluster,
	.drop_item = drop_cluster,
};

static struct configfs_item_operations cluster_ops = {
static const struct configfs_item_operations cluster_ops = {
	.release = release_cluster,
};

static struct configfs_group_operations spaces_ops = {
static const struct configfs_group_operations spaces_ops = {
	.make_group = make_space,
	.drop_item = drop_space,
};

static struct configfs_item_operations space_ops = {
static const struct configfs_item_operations space_ops = {
	.release = release_space,
};

static struct configfs_group_operations comms_ops = {
static const struct configfs_group_operations comms_ops = {
	.make_item = make_comm,
	.drop_item = drop_comm,
};

static struct configfs_item_operations comm_ops = {
static const struct configfs_item_operations comm_ops = {
	.release = release_comm,
};

static struct configfs_group_operations nodes_ops = {
static const struct configfs_group_operations nodes_ops = {
	.make_item = make_node,
	.drop_item = drop_node,
};

static struct configfs_item_operations node_ops = {
static const struct configfs_item_operations node_ops = {
	.release = release_node,
};

+3 −3
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
	char *b, *last_name = NULL;
	int error = -ENOMEM, last_len, nodeid, result;
	uint16_t namelen;
	unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
	unsigned int count = 0, count_bad = 0, count_add = 0;

	log_rinfo(ls, "dlm_recover_directory");

@@ -157,12 +157,12 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
				}

				/* The name was found in rsbtbl, and the
				 * master nodeid matches memb->nodeid. */
				 * master nodeid matches memb->nodeid.

				if (result == DLM_LU_MATCH &&
				    nodeid == memb->nodeid) {
					count_match++;
				}
				}*/

				/* The name was not found in rsbtbl and was
				 * added with memb->nodeid as the master. */
+3 −1
Original line number Diff line number Diff line
@@ -606,7 +606,6 @@ struct dlm_ls {

	struct dlm_rsb		ls_local_rsb;	/* for returning errors */
	struct dlm_lkb		ls_local_lkb;	/* for returning errors */
	struct dlm_message	ls_local_ms;	/* for faking a reply */

	struct dentry		*ls_debug_rsb_dentry; /* debugfs */
	struct dentry		*ls_debug_waiters_dentry; /* debugfs */
@@ -665,6 +664,9 @@ struct dlm_ls {

	int			ls_namelen;
	char			ls_name[DLM_LOCKSPACE_LEN + 1];

	/* Must be last --ends in a flexible-array member.*/
	struct dlm_message	ls_local_ms;	/* for faking a reply */
};

/*
+3 −19
Original line number Diff line number Diff line
@@ -626,7 +626,8 @@ int dlm_search_rsb_tree(struct rhashtable *rhash, const void *name, int len,
			struct dlm_rsb **r_ret)
{
	char key[DLM_RESNAME_MAXLEN] = {};

	if (len > DLM_RESNAME_MAXLEN)
		return -EINVAL;
	memcpy(key, name, len);
	*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
	if (*r_ret)
@@ -5014,25 +5015,8 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb,
				   struct dlm_message *ms_local)
{
	if (middle_conversion(lkb)) {
		log_rinfo(ls, "%s %x middle convert in progress", __func__,
			 lkb->lkb_id);

		/* We sent this lock to the new master. The new master will
		 * tell us when it's granted.  We no longer need a reply, so
		 * use a fake reply to put the lkb into the right state.
		 */
		hold_lkb(lkb);
		memset(ms_local, 0, sizeof(struct dlm_message));
		ms_local->m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
		ms_local->m_result = cpu_to_le32(to_dlm_errno(-EINPROGRESS));
		ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
		_receive_convert_reply(lkb, ms_local, true);
		unhold_lkb(lkb);

	} else if (lkb->lkb_rqmode >= lkb->lkb_grmode) {
	if (middle_conversion(lkb) || lkb->lkb_rqmode >= lkb->lkb_grmode)
		set_bit(DLM_IFL_RESEND_BIT, &lkb->lkb_iflags);
	}

	/* lkb->lkb_rqmode < lkb->lkb_grmode shouldn't happen since down
	   conversions are async; there's no reply from the remote master */
+1 −5
Original line number Diff line number Diff line
@@ -299,11 +299,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
	if (!memb)
		list_add_tail(newlist, head);
	else {
		/* FIXME: can use list macro here */
		newlist->prev = tmp->prev;
		newlist->next = tmp;
		tmp->prev->next = newlist;
		tmp->prev = newlist;
		list_add_tail(newlist, tmp);
	}
}