Skip to content

Commit af23fd9

Browse files
committed
Merge tag 'dlm-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
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
2 parents 7141433 + 2c3a0b7 commit af23fd9

5 files changed

Lines changed: 18 additions & 36 deletions

File tree

fs/dlm/config.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,39 +324,39 @@ struct dlm_member_gone {
324324
struct list_head list; /* space->members_gone */
325325
};
326326

327-
static struct configfs_group_operations clusters_ops = {
327+
static const struct configfs_group_operations clusters_ops = {
328328
.make_group = make_cluster,
329329
.drop_item = drop_cluster,
330330
};
331331

332-
static struct configfs_item_operations cluster_ops = {
332+
static const struct configfs_item_operations cluster_ops = {
333333
.release = release_cluster,
334334
};
335335

336-
static struct configfs_group_operations spaces_ops = {
336+
static const struct configfs_group_operations spaces_ops = {
337337
.make_group = make_space,
338338
.drop_item = drop_space,
339339
};
340340

341-
static struct configfs_item_operations space_ops = {
341+
static const struct configfs_item_operations space_ops = {
342342
.release = release_space,
343343
};
344344

345-
static struct configfs_group_operations comms_ops = {
345+
static const struct configfs_group_operations comms_ops = {
346346
.make_item = make_comm,
347347
.drop_item = drop_comm,
348348
};
349349

350-
static struct configfs_item_operations comm_ops = {
350+
static const struct configfs_item_operations comm_ops = {
351351
.release = release_comm,
352352
};
353353

354-
static struct configfs_group_operations nodes_ops = {
354+
static const struct configfs_group_operations nodes_ops = {
355355
.make_item = make_node,
356356
.drop_item = drop_node,
357357
};
358358

359-
static struct configfs_item_operations node_ops = {
359+
static const struct configfs_item_operations node_ops = {
360360
.release = release_node,
361361
};
362362

fs/dlm/dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
6262
char *b, *last_name = NULL;
6363
int error = -ENOMEM, last_len, nodeid, result;
6464
uint16_t namelen;
65-
unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
65+
unsigned int count = 0, count_bad = 0, count_add = 0;
6666

6767
log_rinfo(ls, "dlm_recover_directory");
6868

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

159159
/* The name was found in rsbtbl, and the
160-
* master nodeid matches memb->nodeid. */
160+
* master nodeid matches memb->nodeid.
161161
162162
if (result == DLM_LU_MATCH &&
163163
nodeid == memb->nodeid) {
164164
count_match++;
165-
}
165+
}*/
166166

167167
/* The name was not found in rsbtbl and was
168168
* added with memb->nodeid as the master. */

fs/dlm/dlm_internal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,6 @@ struct dlm_ls {
606606

607607
struct dlm_rsb ls_local_rsb; /* for returning errors */
608608
struct dlm_lkb ls_local_lkb; /* for returning errors */
609-
struct dlm_message ls_local_ms; /* for faking a reply */
610609

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

666665
int ls_namelen;
667666
char ls_name[DLM_LOCKSPACE_LEN + 1];
667+
668+
/* Must be last --ends in a flexible-array member.*/
669+
struct dlm_message ls_local_ms; /* for faking a reply */
668670
};
669671

670672
/*

fs/dlm/lock.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ int dlm_search_rsb_tree(struct rhashtable *rhash, const void *name, int len,
626626
struct dlm_rsb **r_ret)
627627
{
628628
char key[DLM_RESNAME_MAXLEN] = {};
629-
629+
if (len > DLM_RESNAME_MAXLEN)
630+
return -EINVAL;
630631
memcpy(key, name, len);
631632
*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
632633
if (*r_ret)
@@ -5014,25 +5015,8 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
50145015
static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb,
50155016
struct dlm_message *ms_local)
50165017
{
5017-
if (middle_conversion(lkb)) {
5018-
log_rinfo(ls, "%s %x middle convert in progress", __func__,
5019-
lkb->lkb_id);
5020-
5021-
/* We sent this lock to the new master. The new master will
5022-
* tell us when it's granted. We no longer need a reply, so
5023-
* use a fake reply to put the lkb into the right state.
5024-
*/
5025-
hold_lkb(lkb);
5026-
memset(ms_local, 0, sizeof(struct dlm_message));
5027-
ms_local->m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
5028-
ms_local->m_result = cpu_to_le32(to_dlm_errno(-EINPROGRESS));
5029-
ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
5030-
_receive_convert_reply(lkb, ms_local, true);
5031-
unhold_lkb(lkb);
5032-
5033-
} else if (lkb->lkb_rqmode >= lkb->lkb_grmode) {
5018+
if (middle_conversion(lkb) || lkb->lkb_rqmode >= lkb->lkb_grmode)
50345019
set_bit(DLM_IFL_RESEND_BIT, &lkb->lkb_iflags);
5035-
}
50365020

50375021
/* lkb->lkb_rqmode < lkb->lkb_grmode shouldn't happen since down
50385022
conversions are async; there's no reply from the remote master */

fs/dlm/member.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
299299
if (!memb)
300300
list_add_tail(newlist, head);
301301
else {
302-
/* FIXME: can use list macro here */
303-
newlist->prev = tmp->prev;
304-
newlist->next = tmp;
305-
tmp->prev->next = newlist;
306-
tmp->prev = newlist;
302+
list_add_tail(newlist, tmp);
307303
}
308304
}
309305

0 commit comments

Comments
 (0)