Skip to content

Commit 86cfccb

Browse files
committed
Merge tag 'dlm-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "This set includes a some improvements to the dlm networking layer: improving the ability to trace dlm messages for debugging, and improved handling of bad messages or disrupted connections" * tag 'dlm-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: fs: dlm: implement tcp graceful shutdown fs: dlm: change handling of reconnects fs: dlm: don't close socket on invalid message fs: dlm: set skb mark per peer socket fs: dlm: set skb mark for listen socket net: sock: add sock_set_mark dlm: Fix kobject memleak
2 parents 0e4656a + 055923b commit 86cfccb

File tree

6 files changed

+164
-28
lines changed

6 files changed

+164
-28
lines changed

fs/dlm/config.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct dlm_cluster {
7373
unsigned int cl_log_debug;
7474
unsigned int cl_log_info;
7575
unsigned int cl_protocol;
76+
unsigned int cl_mark;
7677
unsigned int cl_timewarn_cs;
7778
unsigned int cl_waitwarn_us;
7879
unsigned int cl_new_rsb_count;
@@ -96,6 +97,7 @@ enum {
9697
CLUSTER_ATTR_LOG_DEBUG,
9798
CLUSTER_ATTR_LOG_INFO,
9899
CLUSTER_ATTR_PROTOCOL,
100+
CLUSTER_ATTR_MARK,
99101
CLUSTER_ATTR_TIMEWARN_CS,
100102
CLUSTER_ATTR_WAITWARN_US,
101103
CLUSTER_ATTR_NEW_RSB_COUNT,
@@ -168,6 +170,7 @@ CLUSTER_ATTR(scan_secs, 1);
168170
CLUSTER_ATTR(log_debug, 0);
169171
CLUSTER_ATTR(log_info, 0);
170172
CLUSTER_ATTR(protocol, 0);
173+
CLUSTER_ATTR(mark, 0);
171174
CLUSTER_ATTR(timewarn_cs, 1);
172175
CLUSTER_ATTR(waitwarn_us, 0);
173176
CLUSTER_ATTR(new_rsb_count, 0);
@@ -183,6 +186,7 @@ static struct configfs_attribute *cluster_attrs[] = {
183186
[CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug,
184187
[CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info,
185188
[CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol,
189+
[CLUSTER_ATTR_MARK] = &cluster_attr_mark,
186190
[CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs,
187191
[CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us,
188192
[CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count,
@@ -196,6 +200,7 @@ enum {
196200
COMM_ATTR_LOCAL,
197201
COMM_ATTR_ADDR,
198202
COMM_ATTR_ADDR_LIST,
203+
COMM_ATTR_MARK,
199204
};
200205

201206
enum {
@@ -228,6 +233,7 @@ struct dlm_comm {
228233
int nodeid;
229234
int local;
230235
int addr_count;
236+
unsigned int mark;
231237
struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT];
232238
};
233239

@@ -465,6 +471,7 @@ static struct config_item *make_comm(struct config_group *g, const char *name)
465471
cm->nodeid = -1;
466472
cm->local = 0;
467473
cm->addr_count = 0;
474+
cm->mark = 0;
468475
return &cm->item;
469476
}
470477

@@ -660,8 +667,28 @@ static ssize_t comm_addr_list_show(struct config_item *item, char *buf)
660667
return 4096 - allowance;
661668
}
662669

670+
static ssize_t comm_mark_show(struct config_item *item, char *buf)
671+
{
672+
return sprintf(buf, "%u\n", config_item_to_comm(item)->mark);
673+
}
674+
675+
static ssize_t comm_mark_store(struct config_item *item, const char *buf,
676+
size_t len)
677+
{
678+
unsigned int mark;
679+
int rc;
680+
681+
rc = kstrtouint(buf, 0, &mark);
682+
if (rc)
683+
return rc;
684+
685+
config_item_to_comm(item)->mark = mark;
686+
return len;
687+
}
688+
663689
CONFIGFS_ATTR(comm_, nodeid);
664690
CONFIGFS_ATTR(comm_, local);
691+
CONFIGFS_ATTR(comm_, mark);
665692
CONFIGFS_ATTR_WO(comm_, addr);
666693
CONFIGFS_ATTR_RO(comm_, addr_list);
667694

@@ -670,6 +697,7 @@ static struct configfs_attribute *comm_attrs[] = {
670697
[COMM_ATTR_LOCAL] = &comm_attr_local,
671698
[COMM_ATTR_ADDR] = &comm_attr_addr,
672699
[COMM_ATTR_ADDR_LIST] = &comm_attr_addr_list,
700+
[COMM_ATTR_MARK] = &comm_attr_mark,
673701
NULL,
674702
};
675703

@@ -829,6 +857,20 @@ int dlm_comm_seq(int nodeid, uint32_t *seq)
829857
return 0;
830858
}
831859

860+
int dlm_comm_mark(int nodeid, unsigned int *mark)
861+
{
862+
struct dlm_comm *cm;
863+
864+
cm = get_comm(nodeid);
865+
if (!cm)
866+
return -ENOENT;
867+
868+
*mark = cm->mark;
869+
put_comm(cm);
870+
871+
return 0;
872+
}
873+
832874
int dlm_our_nodeid(void)
833875
{
834876
return local_comm ? local_comm->nodeid : 0;
@@ -855,6 +897,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
855897
#define DEFAULT_LOG_DEBUG 0
856898
#define DEFAULT_LOG_INFO 1
857899
#define DEFAULT_PROTOCOL 0
900+
#define DEFAULT_MARK 0
858901
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
859902
#define DEFAULT_WAITWARN_US 0
860903
#define DEFAULT_NEW_RSB_COUNT 128
@@ -871,6 +914,7 @@ struct dlm_config_info dlm_config = {
871914
.ci_log_debug = DEFAULT_LOG_DEBUG,
872915
.ci_log_info = DEFAULT_LOG_INFO,
873916
.ci_protocol = DEFAULT_PROTOCOL,
917+
.ci_mark = DEFAULT_MARK,
874918
.ci_timewarn_cs = DEFAULT_TIMEWARN_CS,
875919
.ci_waitwarn_us = DEFAULT_WAITWARN_US,
876920
.ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT,

fs/dlm/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct dlm_config_info {
3131
int ci_log_debug;
3232
int ci_log_info;
3333
int ci_protocol;
34+
int ci_mark;
3435
int ci_timewarn_cs;
3536
int ci_waitwarn_us;
3637
int ci_new_rsb_count;
@@ -45,6 +46,7 @@ void dlm_config_exit(void);
4546
int dlm_config_nodes(char *lsname, struct dlm_config_node **nodes_out,
4647
int *count_out);
4748
int dlm_comm_seq(int nodeid, uint32_t *seq);
49+
int dlm_comm_mark(int nodeid, unsigned int *mark);
4850
int dlm_our_nodeid(void);
4951
int dlm_our_addr(struct sockaddr_storage *addr, int num);
5052

fs/dlm/lockspace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,16 +622,16 @@ static int new_lockspace(const char *name, const char *cluster,
622622
wait_event(ls->ls_recover_lock_wait,
623623
test_bit(LSFL_RECOVER_LOCK, &ls->ls_flags));
624624

625+
/* let kobject handle freeing of ls if there's an error */
626+
do_unreg = 1;
627+
625628
ls->ls_kobj.kset = dlm_kset;
626629
error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL,
627630
"%s", ls->ls_name);
628631
if (error)
629632
goto out_recoverd;
630633
kobject_uevent(&ls->ls_kobj, KOBJ_ADD);
631634

632-
/* let kobject handle freeing of ls if there's an error */
633-
do_unreg = 1;
634-
635635
/* This uevent triggers dlm_controld in userspace to add us to the
636636
group of nodes that are members of this lockspace (managed by the
637637
cluster infrastructure.) Once it's done that, it tells us who the

0 commit comments

Comments
 (0)