diff --git a/fs/dlm/config.c b/fs/dlm/config.c index a0d75b5c83c6..82cc3215663f 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c @@ -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, }; diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c index b1ab0adbd9d0..01c292379f5b 100644 --- a/fs/dlm/dir.c +++ b/fs/dlm/dir.c @@ -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. */ diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index d534a4bc162b..9df842421ae0 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h @@ -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 */ }; /* diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index be938fdf17d9..a393ecaf3442 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -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 */ diff --git a/fs/dlm/member.c b/fs/dlm/member.c index c0f557a80a75..c1b5598997b7 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c @@ -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); } }