fs: dlm: miscs and msgs processing changes
Subsystems (2)
Alexander Aring
maintainerv2 cover fs: dlm: miscs and msgs processing changes
Hi,
this patch fixes some missing spin_unlock() that was missing in commit dc52cd2eff4a ("fs: dlm: fix F_CANCELLK to cancel pending request"). Otherwise this patch series contains:
- introduce a new debugfs entry to dump all pending callbacks in the per lkb callbacks queue.
- add plock char dev kernel tracepoints for debugging
- change things in parsing/processing dlm messages like only once dereferencing the sequence number of dlm recovery and avoid an additional spinlock later
- constify the dlm receive buffer, it should never be manipulated when parsing it.
- small change in version detection to not use RCOM_NAMES messages
- change to create midcomms node when configfs gets the cluster configuration
I try to prepare to switch the message processing from workqueue context to softirq context. The patch "fs: dlm: create midcomms nodes when configure" will remove creating midcomms nodes that create debugfs entries from the message parsing context. The context for creating debugfs entries is sleepable. The lifetime of a midcomms node is now similar like lowcomms connection struct. Later we hopefully can merge the two hash datastructures midcomms nodes and lowcomms connections into one.
- Alex
changes since v2:
- add a cover-letter
- fix a deadlock case in "fs: dlm: create midcomms nodes when configure"
Alexander Aring (13):
fs: dlm: add missing spin_unlock
fs: dlm: remove unused processed_nodes
fs: dlm: debugfs for queued callbacks
fs: dlm: check on plock ops when exit dlm
fs: dlm: add plock dev tracepoints
fs: dlm: remove clear_members_cb
fs: dlm: cleanup lock order
fs: dlm: get recovery sequence number as parameter
fs: dlm: drop rxbuf manipulation in dlm_copy_master_names
fs: dlm: drop rxbuf manipulation in dlm_recover_master_copy
fs: dlm: constify receive buffer
fs: dlm: create midcomms nodes when configure
fs: dlm: don't use RCOM_NAMES for version detection
fs/dlm/config.c | 2 +- fs/dlm/debug_fs.c | 101 +++++++++++- fs/dlm/dir.c | 14 +- fs/dlm/dir.h | 6 +- fs/dlm/dlm_internal.h | 1 + fs/dlm/lock.c | 120 ++++++++------- fs/dlm/lock.h | 16 +- fs/dlm/lowcomms.c | 1 - fs/dlm/member.c | 15 +- fs/dlm/member.h | 2 +- fs/dlm/midcomms.c | 304 ++++++++++++++----------------------- fs/dlm/midcomms.h | 1 + fs/dlm/plock.c | 9 ++ fs/dlm/rcom.c | 102 +++++++------ fs/dlm/rcom.h | 15 +- fs/dlm/recover.c | 60 ++++---- fs/dlm/recover.h | 14 +- fs/dlm/recoverd.c | 16 +- fs/dlm/requestqueue.c | 3 +- fs/dlm/requestqueue.h | 3 +- include/trace/events/dlm.h | 51 +++++++ 21 files changed, 489 insertions(+), 367 deletions(-)
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 1/13 fs: dlm: add missing spin_unlock
This patch fixes commit dc52cd2eff4a ("fs: dlm: fix F_CANCELLK to cancel pending request") that we don't unlock the ops_lock in a rate case when a waiter cannot be found. This case can only happen when cancellation of plock operation was successful but no kernel waiter was being found.
--- fs/dlm/plock.c | 1 + 1 file changed, 1 insertion(+)
fs/dlm/plock.c +1 -0
@@ -398,6 +398,7 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file,*/ op =plock_lookup_waiter (&info);if (WARN_ON_ONCE (!op)) { +spin_unlock (&ops_lock); rv = -ENOLCK ;break ; }
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 2/13 fs: dlm: remove unused processed_nodes
In reply to Alexander AringThe variable processed_nodes is not being used by commit 1696c75f1864 ("fs: dlm: add send ack threshold and append acks to msgs"). This patch removes the leftover of this commit.
--- fs/dlm/lowcomms.c | 1 - 1 file changed, 1 deletion(-)
fs/dlm/lowcomms.c +0 -1
@@ -863,7 +863,6 @@ struct dlm_processed_nodes {static void process_dlm_messages (struct work_struct *work) {struct processqueue_entry *pentry; -LIST_HEAD (processed_nodes);spin_lock (&processqueue_lock); pentry = list_first_entry_or_null(&processqueue,
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 3/13 fs: dlm: debugfs for queued callbacks
In reply to Alexander AringIt was useful to debug an issue with the callback queue to check if any callbacks in any lkb are for some reason not processed by the callback workqueue. The mentioned issue was fixed by commit a034c1370ded ("fs:
dlm: fix DLM_IFL_CB_PENDING gets overwritten"). If there are similar issue that looks like a ast callback was not processed, we can confirm now that it is not sitting to be processed by the callback workqueue anymore.
--- fs/dlm/debug_fs.c | 101 +++++++++++++++++++++++++++++++++++++++++- fs/dlm/dlm_internal.h | 1 + 2 files changed, 101 insertions(+), 1 deletion(-)
fs/dlm/debug_fs.c +100 -1
@@ -18,6 +18,7 @@#include "dlm_internal.h" #include "midcomms.h" #include "lock.h" +#include "ast.h" #define DLM_DEBUG_BUF_LEN 4096static char debug_buf[DLM_DEBUG_BUF_LEN ];
@@ -365,6 +366,52 @@ static void print_format4(struct dlm_rsb *r, struct seq_file *s)unlock_rsb (r); } +static void print_format5_lock (struct seq_file *s,struct dlm_lkb *lkb) +{ +struct dlm_callback *cb; + +/* lkb_id lkb_flags mode flags sb_status sb_flags */ + +spin_lock (&lkb->lkb_cb_lock); +list_for_each_entry (cb, &lkb->lkb_callbacks, list) { +seq_printf (s,"%x %x %d %x %d %x\n" , + lkb->lkb_id, +dlm_iflags_val (lkb), + cb->mode, + cb->flags, + cb->sb_status, + cb->sb_flags); + } +spin_unlock (&lkb->lkb_cb_lock); +} + +static void print_format5 (struct dlm_rsb *r,struct seq_file *s) +{ +struct dlm_lkb *lkb; + +lock_rsb (r); + +list_for_each_entry (lkb, &r->res_grantqueue, lkb_statequeue) { +print_format5_lock (s, lkb); +if (seq_has_overflowed (s)) + goto out; + } + +list_for_each_entry (lkb, &r->res_convertqueue, lkb_statequeue) { +print_format5_lock (s, lkb); +if (seq_has_overflowed (s)) + goto out; + } + +list_for_each_entry (lkb, &r->res_waitqueue, lkb_statequeue) { +print_format5_lock (s, lkb); +if (seq_has_overflowed (s)) + goto out; + } + out: +unlock_rsb (r); +} +struct rsbtbl_iter {struct dlm_rsb *rsb;unsigned bucket;
@@ -408,6 +455,13 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr) }print_format4 (ri->rsb, seq);break ; +case 5 : +if (ri->header) { +seq_puts (seq,"lkb_id lkb_flags mode flags sb_status sb_flags\n" ); + ri->header =0 ; + } +print_format5 (ri->rsb, seq); +break ; }return 0 ;
@@ -417,6 +471,7 @@ static const struct seq_operations format1_seq_ops;static const struct seq_operations format2_seq_ops;static const struct seq_operations format3_seq_ops;static const struct seq_operations format4_seq_ops; +static const struct seq_operations format5_seq_ops;static void *table_seq_start (struct seq_file *seq,loff_t *pos) {
@@ -448,6 +503,8 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos) ri->format =3 ;if (seq->op == &format4_seq_ops) ri->format =4 ; +if (seq->op == &format5_seq_ops) + ri->format =5 ; tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
@@ -602,10 +659,18 @@ static const struct seq_operations format4_seq_ops = { .show = table_seq_show, }; +static const struct seq_operations format5_seq_ops = { + .start = table_seq_start, + .next = table_seq_next, + .stop = table_seq_stop, + .show = table_seq_show, +}; +static const struct file_operations format1_fops;static const struct file_operations format2_fops;static const struct file_operations format3_fops;static const struct file_operations format4_fops; +static const struct file_operations format5_fops;static int table_open1 (struct inode *inode,struct file *file) {
@@ -683,7 +748,21 @@ static int table_open4(struct inode *inode, struct file *file)struct seq_file *seq;int ret; - ret =seq_open (file, &format4_seq_ops); + ret =seq_open (file, &format5_seq_ops); +if (ret) +return ret; + + seq = file->private_data; + seq->private = inode->i_private;/* the dlm_ls */ +return 0 ; +} + +static int table_open5 (struct inode *inode,struct file *file) +{ +struct seq_file *seq; +int ret; + + ret =seq_open (file, &format5_seq_ops);if (ret)return ret;
@@ -725,6 +804,14 @@ static const struct file_operations format4_fops = { .release = seq_release }; +static const struct file_operations format5_fops = { + .owner =THIS_MODULE , + .open = table_open5, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release +}; +/* * dump lkb's on the ls_waiters list */
@@ -793,6 +880,7 @@ void dlm_delete_debug_file(struct dlm_ls *ls)debugfs_remove (ls->ls_debug_locks_dentry);debugfs_remove (ls->ls_debug_all_dentry);debugfs_remove (ls->ls_debug_toss_dentry); +debugfs_remove (ls->ls_debug_queued_asts_dentry); }static int dlm_state_show (struct seq_file *file,void *offset)
@@ -936,6 +1024,17 @@ void dlm_create_debug_file(struct dlm_ls *ls) dlm_root, ls, &waiters_fops); + +/* format 5 */ + +memset (name,0 ,sizeof (name)); +snprintf (name,DLM_LOCKSPACE_LEN +8 ,"%s_queued_asts" , ls->ls_name); + + ls->ls_debug_queued_asts_dentry =debugfs_create_file (name, +0644 , + dlm_root, + ls, + &format5_fops); }void __init dlm_register_debugfs (void )
fs/dlm/dlm_internal.h +1 -0
@@ -598,6 +598,7 @@ struct dlm_ls {struct dentry *ls_debug_locks_dentry;/* debugfs */ struct dentry *ls_debug_all_dentry;/* debugfs */ struct dentry *ls_debug_toss_dentry;/* debugfs */ +struct dentry *ls_debug_queued_asts_dentry;/* debugfs */ wait_queue_head_t ls_uevent_wait;/* user part of join/leave */ int ls_uevent_result;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 4/13 fs: dlm: check on plock ops when exit dlm
In reply to Alexander AringTo be sure we don't have any issues that there are leftover plock ops in either send_list or recv_list we simple check if either one of the list are empty when we exit the dlm subsystem.
--- fs/dlm/plock.c | 2 ++ 1 file changed, 2 insertions(+)
fs/dlm/plock.c +2 -0
@@ -628,5 +628,7 @@ int dlm_plock_init(void)void dlm_plock_exit (void ) {misc_deregister (&plock_dev_misc); +WARN_ON (!list_empty (&send_list)); +WARN_ON (!list_empty (&recv_list)); }
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 5/13 fs: dlm: add plock dev tracepoints
In reply to Alexander AringI currently debug nfs plock handling and introduce those two tracepoints for getting more information about what is happening there if the user space reads plock operations from kernel and writing the result back.
--- fs/dlm/plock.c | 6 +++++ include/trace/events/dlm.h | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
fs/dlm/plock.c +6 -0
@@ -11,6 +11,8 @@#include <linux/dlm_plock.h> #include <linux/slab.h> +#include <trace/events/dlm.h> +#include "dlm_internal.h" #include "lockspace.h"
@@ -509,6 +511,8 @@ static ssize_t dev_read(struct file *file, char __user *u, size_t count,if (!op)return -EAGAIN ; +trace_dlm_plock_read (&info); +/* there is no need to get a reply from userspace for unlocks that were generated by the vfs cleaning up for a close (the process did not make an unlock call). */
@@ -536,6 +540,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,if (copy_from_user (&info, u,sizeof (info)))return -EFAULT ; +trace_dlm_plock_write (&info); +if (check_version (&info))return -EINVAL ;
include/trace/events/dlm.h +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 6/13 fs: dlm: remove clear_members_cb
In reply to Alexander AringThis patch is just a small cleanup to directly call remove_remote_member() instead of going over clear_members_cb() which just calls remove_remote_member().
--- fs/dlm/member.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/dlm/member.c +1 -6
@@ -393,14 +393,9 @@ static void remove_remote_member(int nodeid)dlm_midcomms_remove_member (nodeid); } -static void clear_members_cb (int nodeid) -{ -remove_remote_member (nodeid); -} -void dlm_clear_members (struct dlm_ls *ls) { -clear_memb_list (&ls->ls_nodes, clear_members_cb); +clear_memb_list (&ls->ls_nodes, remove_remote_member); ls->ls_num_nodes =0 ; }
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 7/13 fs: dlm: cleanup lock order
In reply to Alexander AringThis patch cleanups the lock order to hold at first the close_lock and then held the nodes_srcu read lock. Probably it will never be a problem as nodes_srcu is only a read lock preventing the node pointer getting freed.
--- fs/dlm/midcomms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/dlm/midcomms.c +2 -2
@@ -1489,12 +1489,12 @@ int dlm_midcomms_close(int nodeid)synchronize_srcu (&nodes_srcu); - idx =srcu_read_lock (&nodes_srcu);mutex_lock (&close_lock); + idx =srcu_read_lock (&nodes_srcu); node =nodeid2node (nodeid,0 );if (!node) { -mutex_unlock (&close_lock);srcu_read_unlock (&nodes_srcu, idx); +mutex_unlock (&close_lock);return dlm_lowcomms_close (nodeid); }
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 8/13 fs: dlm: get recovery sequence number as parameter
In reply to Alexander AringThis patch removes a read of the ls->ls_recover_seq uint64_t number in _create_rcom(). If the ls->ls_recover_seq is readed the ls_recover_lock need to held. However this number was always readed before when any rcom message is received and it's not necessary to read it again from a per lockspace variable to use it for the replying message. This patch will pass the sequence number as parameter so another read of ls->ls_recover_seq and holding the ls->ls_recover_lock is not required.
--- fs/dlm/dir.c | 4 +-- fs/dlm/dir.h | 2 +- fs/dlm/lock.c | 5 ++-- fs/dlm/lock.h | 3 ++- fs/dlm/member.c | 6 ++--- fs/dlm/rcom.c | 68 ++++++++++++++++++++++++++--------------------- fs/dlm/rcom.h | 10 ++++--- fs/dlm/recover.c | 58 +++++++++++++++++++++------------------- fs/dlm/recover.h | 12 ++++----- fs/dlm/recoverd.c | 16 +++++------ 10 files changed, 99 insertions(+), 85 deletions(-)
fs/dlm/dir.c +2 -2
@@ -58,7 +58,7 @@ void dlm_recover_dir_nodeid(struct dlm_ls *ls)up_read (&ls->ls_root_sem); } -int dlm_recover_directory (struct dlm_ls *ls) +int dlm_recover_directory (struct dlm_ls *ls,uint64_t seq) {struct dlm_member *memb;char *b, *last_name =NULL ;
@@ -90,7 +90,7 @@ int dlm_recover_directory(struct dlm_ls *ls) } error =dlm_rcom_names (ls, memb->nodeid, - last_name, last_len); + last_name, last_len, seq);if (error) goto out_free;
fs/dlm/dir.h +1 -1
@@ -15,7 +15,7 @@int dlm_dir_nodeid (struct dlm_rsb *rsb);int dlm_hash2nodeid (struct dlm_ls *ls,uint32_t hash);void dlm_recover_dir_nodeid (struct dlm_ls *ls); -int dlm_recover_directory (struct dlm_ls *ls); +int dlm_recover_directory (struct dlm_ls *ls,uint64_t seq);void dlm_copy_master_names (struct dlm_ls *ls,char *inbuf,int inlen,char *outbuf,int outlen,int nodeid);
fs/dlm/lock.c +3 -2
@@ -5464,7 +5464,8 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc) }/* needs at least dlm_rcom + rcom_lock */ -int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc) +int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +uint64_t seq) {struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;struct dlm_rsb *r;
@@ -5509,7 +5510,7 @@ int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc) lkid,le32_to_cpu (rc->rc_header.h_nodeid), remid, result); -dlm_send_rcom_lock (r, lkb); +dlm_send_rcom_lock (r, lkb, seq); goto out;case -EEXIST :case 0 :
fs/dlm/lock.h +2 -1
@@ -37,7 +37,8 @@ void dlm_recover_grant(struct dlm_ls *ls);int dlm_recover_waiters_post (struct dlm_ls *ls);void dlm_recover_waiters_pre (struct dlm_ls *ls);int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc); -int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc); +int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +uint64_t seq);int dlm_user_request (struct dlm_ls *ls,struct dlm_user_args *ua,int mode,uint32_t flags,void *name,unsigned int namelen);
fs/dlm/member.c +3 -3
@@ -449,7 +449,7 @@ static void make_member_array(struct dlm_ls *ls)/* send a status request to all members just to establish comms connections */ -static int ping_members (struct dlm_ls *ls) +static int ping_members (struct dlm_ls *ls,uint64_t seq) {struct dlm_member *memb;int error =0 ;
@@ -459,7 +459,7 @@ static int ping_members(struct dlm_ls *ls) error = -EINTR ;break ; } - error =dlm_rcom_status (ls, memb->nodeid,0 ); + error =dlm_rcom_status (ls, memb->nodeid,0 , seq);if (error)break ; }
@@ -607,7 +607,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)make_member_array (ls); *neg_out = neg; - error =ping_members (ls); + error =ping_members (ls, rv->seq);log_rinfo (ls,"dlm_recover_members %d nodes" , ls->ls_num_nodes);return error; }
fs/dlm/rcom.c +38 -30
222 lines not on this page · raw message
fs/dlm/rcom.h +6 -4
@@ -12,10 +12,12 @@#ifndef __RCOM_DOT_H__#define __RCOM_DOT_H__ -int dlm_rcom_status (struct dlm_ls *ls,int nodeid,uint32_t status_flags); -int dlm_rcom_names (struct dlm_ls *ls,int nodeid,char *last_name,int last_len); -int dlm_send_rcom_lookup (struct dlm_rsb *r,int dir_nodeid); -int dlm_send_rcom_lock (struct dlm_rsb *r,struct dlm_lkb *lkb); +int dlm_rcom_status (struct dlm_ls *ls,int nodeid,uint32_t status_flags, +uint64_t seq); +int dlm_rcom_names (struct dlm_ls *ls,int nodeid,char *last_name, +int last_len,uint64_t seq); +int dlm_send_rcom_lookup (struct dlm_rsb *r,int dir_nodeid,uint64_t seq); +int dlm_send_rcom_lock (struct dlm_rsb *r,struct dlm_lkb *lkb,uint64_t seq);void dlm_receive_rcom (struct dlm_ls *ls,struct dlm_rcom *rc,int nodeid);int dlm_send_ls_not_ready (int nodeid,struct dlm_rcom *rc_in);
fs/dlm/recover.c +30 -28
188 lines not on this page · raw message
fs/dlm/recover.h +6 -6
@@ -15,13 +15,13 @@int dlm_wait_function (struct dlm_ls *ls,int (*testfn) (struct dlm_ls *ls));uint32_t dlm_recover_status (struct dlm_ls *ls);void dlm_set_recover_status (struct dlm_ls *ls,uint32_t status); -int dlm_recover_members_wait (struct dlm_ls *ls); -int dlm_recover_directory_wait (struct dlm_ls *ls); -int dlm_recover_locks_wait (struct dlm_ls *ls); -int dlm_recover_done_wait (struct dlm_ls *ls); -int dlm_recover_masters (struct dlm_ls *ls); +int dlm_recover_members_wait (struct dlm_ls *ls,uint64_t seq); +int dlm_recover_directory_wait (struct dlm_ls *ls,uint64_t seq); +int dlm_recover_locks_wait (struct dlm_ls *ls,uint64_t seq); +int dlm_recover_done_wait (struct dlm_ls *ls,uint64_t seq); +int dlm_recover_masters (struct dlm_ls *ls,uint64_t seq);int dlm_recover_master_reply (struct dlm_ls *ls,struct dlm_rcom *rc); -int dlm_recover_locks (struct dlm_ls *ls); +int dlm_recover_locks (struct dlm_ls *ls,uint64_t seq);void dlm_recovered_lock (struct dlm_rsb *r);int dlm_create_root_list (struct dlm_ls *ls);void dlm_release_root_list (struct dlm_ls *ls);
fs/dlm/recoverd.c +8 -8
@@ -90,7 +90,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)dlm_set_recover_status (ls,DLM_RS_NODES ); - error =dlm_recover_members_wait (ls); + error =dlm_recover_members_wait (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_members_wait error %d" , error); goto fail;
@@ -103,7 +103,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)* nodes their master rsb names that hash to us. */ - error =dlm_recover_directory (ls); + error =dlm_recover_directory (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_directory error %d" , error); goto fail;
@@ -111,7 +111,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)dlm_set_recover_status (ls,DLM_RS_DIR ); - error =dlm_recover_directory_wait (ls); + error =dlm_recover_directory_wait (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_directory_wait error %d" , error); goto fail;
@@ -145,7 +145,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)* departed nodes. */ - error =dlm_recover_masters (ls); + error =dlm_recover_masters (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_masters error %d" , error); goto fail;
@@ -155,7 +155,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)* Send our locks on remastered rsb's to the new masters. */ - error =dlm_recover_locks (ls); + error =dlm_recover_locks (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_locks error %d" , error); goto fail;
@@ -163,7 +163,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)dlm_set_recover_status (ls,DLM_RS_LOCKS ); - error =dlm_recover_locks_wait (ls); + error =dlm_recover_locks_wait (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_locks_wait error %d" , error); goto fail;
@@ -187,7 +187,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)*/ dlm_set_recover_status (ls,DLM_RS_LOCKS ); - error =dlm_recover_locks_wait (ls); + error =dlm_recover_locks_wait (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_locks_wait error %d" , error); goto fail;
@@ -206,7 +206,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)dlm_set_recover_status (ls,DLM_RS_DONE ); - error =dlm_recover_done_wait (ls); + error =dlm_recover_done_wait (ls, rv->seq);if (error) {log_rinfo (ls,"dlm_recover_done_wait error %d" , error); goto fail;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 9/13 fs: dlm: drop rxbuf manipulation in dlm_copy_master_names
In reply to Alexander AringThis patch removes the manipulation of the receive buffer in case of an error and be sure the buffer is null terminated before an error messagea is printed out. Instead of manipulate the receive buffer we tell inside the format string the maximum length the string buffer is being read.
--- fs/dlm/dir.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/dlm/dir.c +2 -3
@@ -245,9 +245,8 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,if (inlen >1 ) { r =find_rsb_root (ls, inbuf, inlen);if (!r) { - inbuf[inlen -1 ] ='\0' ; -log_error (ls,"copy_master_names from %d start %d %s" , - nodeid, inlen, inbuf); +log_error (ls,"copy_master_names from %d start %d %.*s" , + nodeid, inlen, inlen, inbuf); goto out; } list = r->res_root_list.next;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 10/13 fs: dlm: drop rxbuf manipulation in dlm_recover_master_copy
In reply to Alexander AringCurrently dlm_recover_master_copy() manipulates the receive buffer of an rcom lock message and modifies it on the fly so a later memcpy() to a new rcom message with the same message has those new values. This patch avoids manipulating the received rcom message by store the values for the new rcom message in paremter assigned with call by reference. Later when dlm_send_rcom_lock() constructs a new message and memcpy() the receive buffer those values will be set on the new constructed message.
--- fs/dlm/lock.c | 10 +++++++--- fs/dlm/lock.h | 3 ++- fs/dlm/rcom.c | 12 ++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-)
fs/dlm/lock.c +7 -3
@@ -5384,7 +5384,8 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,back the rcom_lock struct we got but with the remid field filled in. */ /* needs at least dlm_rcom + rcom_lock */ -int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc) +int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +__le32 *rl_remid,__le32 *rl_result) {struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;struct dlm_rsb *r;
@@ -5393,6 +5394,9 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc)int from_nodeid =le32_to_cpu (rc->rc_header.h_nodeid);int error; +/* init rl_remid with rcom lock rl_remid */ + *rl_remid = rl->rl_remid; +if (rl->rl_parent_lkid) { error = -EOPNOTSUPP ; goto out;
@@ -5448,7 +5452,7 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc) out_remid:/* this is the new value returned to the lock holder for saving in its process-copy lkb */ - rl->rl_remid =cpu_to_le32 (lkb->lkb_id); + *rl_remid =cpu_to_le32 (lkb->lkb_id); lkb->lkb_recover_seq = ls->ls_recover_seq;
@@ -5459,7 +5463,7 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc)if (error && error != -EEXIST )log_rinfo (ls,"dlm_recover_master_copy remote %d %x error %d" , from_nodeid, remid, error); - rl->rl_result =cpu_to_le32 (error); + *rl_result =cpu_to_le32 (error);return error; }
fs/dlm/lock.h +2 -1
@@ -36,7 +36,8 @@ void dlm_purge_mstcpy_locks(struct dlm_rsb *r);void dlm_recover_grant (struct dlm_ls *ls);int dlm_recover_waiters_post (struct dlm_ls *ls);void dlm_recover_waiters_pre (struct dlm_ls *ls); -int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc); +int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +__le32 *rl_remid,__le32 *rl_result);int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc,uint64_t seq);
fs/dlm/rcom.c +8 -4
@@ -472,21 +472,25 @@ int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb, uint64_t seq)static void receive_rcom_lock (struct dlm_ls *ls,struct dlm_rcom *rc_in,uint64_t seq) { +__le32 rl_remid, rl_result; +struct rcom_lock *rl;struct dlm_rcom *rc;struct dlm_mhandle *mh;int error, nodeid =le32_to_cpu (rc_in->rc_header.h_nodeid); -dlm_recover_master_copy (ls, rc_in); +dlm_recover_master_copy (ls, rc_in, &rl_remid, &rl_result); error =create_rcom (ls, nodeid,DLM_RCOM_LOCK_REPLY ,sizeof (struct rcom_lock ), &rc, &mh, seq);if (error)return ; -/* We send back the same rcom_lock struct we received, but -dlm_recover_master_copy() has filled in rl_remid and rl_result */ -memcpy (rc->rc_buf, rc_in->rc_buf,sizeof (struct rcom_lock )); + rl = (struct rcom_lock *)rc->rc_buf; +/* set rl_remid and rl_result from dlm_recover_master_copy() */ + rl->rl_remid = rl_remid; + rl->rl_result = rl_result; + rc->rc_id = rc_in->rc_id; rc->rc_seq_reply = rc_in->rc_seq;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 11/13 fs: dlm: constify receive buffer
In reply to Alexander AringThe dlm receive buffer should be never manipulated as DLM is the last instance of parsing layer. This patch constify the whole receive buffer so we are sure it never gets manipulated when it's being parsed.
--- fs/dlm/dir.c | 5 +- fs/dlm/dir.h | 4 +- fs/dlm/lock.c | 109 ++++++++++++++++++++++-------------------- fs/dlm/lock.h | 14 +++--- fs/dlm/member.c | 2 +- fs/dlm/member.h | 2 +- fs/dlm/midcomms.c | 16 ++++--- fs/dlm/rcom.c | 20 ++++---- fs/dlm/rcom.h | 5 +- fs/dlm/recover.c | 2 +- fs/dlm/recover.h | 2 +- fs/dlm/requestqueue.c | 3 +- fs/dlm/requestqueue.h | 3 +- 13 files changed, 101 insertions(+), 86 deletions(-)
fs/dlm/dir.c +3 -2
@@ -196,7 +196,8 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)return error; } -static struct dlm_rsb *find_rsb_root (struct dlm_ls *ls,char *name,int len) +static struct dlm_rsb *find_rsb_root (struct dlm_ls *ls,const char *name, +int len) {struct dlm_rsb *r;uint32_t hash, bucket;
@@ -232,7 +233,7 @@ static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len)for rsb's we're master of and whose directory node matches the requesting node. inbuf is the rsb name last sent, inlen is the name's length */ -void dlm_copy_master_names (struct dlm_ls *ls,char *inbuf,int inlen, +void dlm_copy_master_names (struct dlm_ls *ls,const char *inbuf,int inlen,char *outbuf,int outlen,int nodeid) {struct list_head *list;
fs/dlm/dir.h +2 -2
@@ -16,8 +16,8 @@ int dlm_dir_nodeid(struct dlm_rsb *rsb);int dlm_hash2nodeid (struct dlm_ls *ls,uint32_t hash);void dlm_recover_dir_nodeid (struct dlm_ls *ls);int dlm_recover_directory (struct dlm_ls *ls,uint64_t seq); -void dlm_copy_master_names (struct dlm_ls *ls,char *inbuf,int inlen, -char *outbuf,int outlen,int nodeid); +void dlm_copy_master_names (struct dlm_ls *ls,const char *inbuf,int inlen, +char *outbuf,int outlen,int nodeid);#endif /* __DIR_DOT_H__ */
fs/dlm/lock.c +58 -51
366 lines not on this page · raw message
fs/dlm/lock.h +7 -7
@@ -12,11 +12,11 @@#define __LOCK_DOT_H__void dlm_dump_rsb (struct dlm_rsb *r); -void dlm_dump_rsb_name (struct dlm_ls *ls,char *name,int len); +void dlm_dump_rsb_name (struct dlm_ls *ls,const char *name,int len);void dlm_print_lkb (struct dlm_lkb *lkb); -void dlm_receive_message_saved (struct dlm_ls *ls,struct dlm_message *ms, +void dlm_receive_message_saved (struct dlm_ls *ls,const struct dlm_message *ms,uint32_t saved_seq); -void dlm_receive_buffer (union dlm_packet *p,int nodeid); +void dlm_receive_buffer (const union dlm_packet *p,int nodeid);int dlm_modes_compat (int mode1,int mode2);void dlm_put_rsb (struct dlm_rsb *r);void dlm_hold_rsb (struct dlm_rsb *r);
@@ -25,8 +25,8 @@ void dlm_scan_rsbs(struct dlm_ls *ls);int dlm_lock_recovery_try (struct dlm_ls *ls);void dlm_unlock_recovery (struct dlm_ls *ls); -int dlm_master_lookup (struct dlm_ls *ls,int nodeid,char *name,int len, -unsigned int flags,int *r_nodeid,int *result); +int dlm_master_lookup (struct dlm_ls *ls,int from_nodeid,const char *name, +int len,unsigned int flags,int *r_nodeid,int *result);int dlm_search_rsb_tree (struct rb_root *tree,const void *name,int len,struct dlm_rsb **r_ret);
@@ -36,9 +36,9 @@ void dlm_purge_mstcpy_locks(struct dlm_rsb *r);void dlm_recover_grant (struct dlm_ls *ls);int dlm_recover_waiters_post (struct dlm_ls *ls);void dlm_recover_waiters_pre (struct dlm_ls *ls); -int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +int dlm_recover_master_copy (struct dlm_ls *ls,const struct dlm_rcom *rc,__le32 *rl_remid,__le32 *rl_result); -int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc, +int dlm_recover_process_copy (struct dlm_ls *ls,const struct dlm_rcom *rc,uint64_t seq); int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode,
fs/dlm/member.c +1 -1
@@ -18,7 +18,7 @@#include "midcomms.h" #include "lowcomms.h" -int dlm_slots_version (struct dlm_header *h) +int dlm_slots_version (const struct dlm_header *h) {if ((le32_to_cpu (h->h_version) &0x0000FFFF ) <DLM_HEADER_SLOTS )return 0 ;
fs/dlm/member.h +1 -1
@@ -18,7 +18,7 @@ void dlm_clear_members_gone(struct dlm_ls *ls);int dlm_recover_members (struct dlm_ls *ls,struct dlm_recover *rv,int *neg_out);int dlm_is_removed (struct dlm_ls *ls,int nodeid);int dlm_is_member (struct dlm_ls *ls,int nodeid); -int dlm_slots_version (struct dlm_header *h); +int dlm_slots_version (const struct dlm_header *h);void dlm_slot_save (struct dlm_ls *ls,struct dlm_rcom *rc,struct dlm_member *memb);void dlm_slots_copy_out (struct dlm_ls *ls,struct dlm_rcom *rc);
fs/dlm/midcomms.c +9 -7
@@ -499,7 +499,8 @@ static void dlm_pas_fin_ack_rcv(struct midcomms_node *node)spin_unlock (&node->state_lock); } -static void dlm_receive_buffer_3_2_trace (uint32_t seq,union dlm_packet *p) +static void dlm_receive_buffer_3_2_trace (uint32_t seq, +const union dlm_packet *p) {switch (p->header.h_cmd) {case DLM_MSG :
@@ -513,7 +514,7 @@ static void dlm_receive_buffer_3_2_trace(uint32_t seq, union dlm_packet *p) } } -static void dlm_midcomms_receive_buffer (union dlm_packet *p, +static void dlm_midcomms_receive_buffer (const union dlm_packet *p,struct midcomms_node *node,uint32_t seq) {
@@ -708,7 +709,8 @@ static int dlm_midcomms_version_check_3_2(struct midcomms_node *node)return 0 ; } -static int dlm_opts_check_msglen (union dlm_packet *p,uint16_t msglen,int nodeid) +static int dlm_opts_check_msglen (const union dlm_packet *p,uint16_t msglen, +int nodeid) {int len = msglen;
@@ -757,7 +759,7 @@ static int dlm_opts_check_msglen(union dlm_packet *p, uint16_t msglen, int nodeireturn 0 ; } -static void dlm_midcomms_receive_buffer_3_2 (union dlm_packet *p,int nodeid) +static void dlm_midcomms_receive_buffer_3_2 (const union dlm_packet *p,int nodeid) {uint16_t msglen =le16_to_cpu (p->header.h_length);struct midcomms_node *node;
@@ -878,7 +880,7 @@ static int dlm_midcomms_version_check_3_1(struct midcomms_node *node)return 0 ; } -static void dlm_midcomms_receive_buffer_3_1 (union dlm_packet *p,int nodeid) +static void dlm_midcomms_receive_buffer_3_1 (const union dlm_packet *p,int nodeid) {uint16_t msglen =le16_to_cpu (p->header.h_length);struct midcomms_node *node;
@@ -977,10 +979,10 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)switch (hd->h_version) {case cpu_to_le32 (DLM_VERSION_3_1 ): -dlm_midcomms_receive_buffer_3_1 ((union dlm_packet *)ptr, nodeid); +dlm_midcomms_receive_buffer_3_1 ((const union dlm_packet *)ptr, nodeid);break ;case cpu_to_le32 (DLM_VERSION_3_2 ): -dlm_midcomms_receive_buffer_3_2 ((union dlm_packet *)ptr, nodeid); +dlm_midcomms_receive_buffer_3_2 ((const union dlm_packet *)ptr, nodeid);break ;default : log_print("received invalid version header: %u from node %d, will skip this message",
fs/dlm/rcom.c +11 -9
@@ -221,7 +221,8 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags,return error; } -static void receive_rcom_status (struct dlm_ls *ls,struct dlm_rcom *rc_in, +static void receive_rcom_status (struct dlm_ls *ls, +const struct dlm_rcom *rc_in,uint64_t seq) {struct dlm_rcom *rc;
@@ -283,7 +284,7 @@ static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in,send_rcom_stateless (msg, rc); } -static void receive_sync_reply (struct dlm_ls *ls,struct dlm_rcom *rc_in) +static void receive_sync_reply (struct dlm_ls *ls,const struct dlm_rcom *rc_in) {spin_lock (&ls->ls_rcom_spin); if (!test_bit(LSFL_RCOM_WAIT, &ls->ls_flags) ||
@@ -333,7 +334,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name,return error; } -static void receive_rcom_names (struct dlm_ls *ls,struct dlm_rcom *rc_in, +static void receive_rcom_names (struct dlm_ls *ls,const struct dlm_rcom *rc_in,uint64_t seq) {struct dlm_rcom *rc;
@@ -376,8 +377,8 @@ int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid, uint64_t seq)return error; } -static void receive_rcom_lookup (struct dlm_ls *ls,struct dlm_rcom *rc_in, -uint64_t seq) +static void receive_rcom_lookup (struct dlm_ls *ls, +const struct dlm_rcom *rc_in,uint64_t seq) {struct dlm_rcom *rc;struct dlm_mhandle *mh;
@@ -408,7 +409,8 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in,send_rcom (mh, rc); } -static void receive_rcom_lookup_reply (struct dlm_ls *ls,struct dlm_rcom *rc_in) +static void receive_rcom_lookup_reply (struct dlm_ls *ls, +const struct dlm_rcom *rc_in) {dlm_recover_master_reply (ls, rc_in); }
@@ -469,7 +471,7 @@ int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb, uint64_t seq) }/* needs at least dlm_rcom + rcom_lock */ -static void receive_rcom_lock (struct dlm_ls *ls,struct dlm_rcom *rc_in, +static void receive_rcom_lock (struct dlm_ls *ls,const struct dlm_rcom *rc_in,uint64_t seq) {__le32 rl_remid, rl_result;
@@ -500,7 +502,7 @@ static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in,/* If the lockspace doesn't exist then still send a status message back; it's possible that it just doesn't have its global_id yet. */ -int dlm_send_ls_not_ready (int nodeid,struct dlm_rcom *rc_in) +int dlm_send_ls_not_ready (int nodeid,const struct dlm_rcom *rc_in) {struct dlm_rcom *rc;struct rcom_config *rf;
@@ -578,7 +580,7 @@ int dlm_send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)/* Called by dlm_recv; corresponds to dlm_receive_message() but special recovery-only comms are sent through here. */ -void dlm_receive_rcom (struct dlm_ls *ls,struct dlm_rcom *rc,int nodeid) +void dlm_receive_rcom (struct dlm_ls *ls,const struct dlm_rcom *rc,int nodeid) {int lock_size =sizeof (struct dlm_rcom ) +sizeof (struct rcom_lock );int stop, reply =0 , names =0 , lookup =0 , lock =0 ;
fs/dlm/rcom.h +3 -2
@@ -18,8 +18,9 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len, uint64_t seq);int dlm_send_rcom_lookup (struct dlm_rsb *r,int dir_nodeid,uint64_t seq);int dlm_send_rcom_lock (struct dlm_rsb *r,struct dlm_lkb *lkb,uint64_t seq); -void dlm_receive_rcom (struct dlm_ls *ls,struct dlm_rcom *rc,int nodeid); -int dlm_send_ls_not_ready (int nodeid,struct dlm_rcom *rc_in); +void dlm_receive_rcom (struct dlm_ls *ls,const struct dlm_rcom *rc, +int nodeid); +int dlm_send_ls_not_ready (int nodeid,const struct dlm_rcom *rc_in);#endif
fs/dlm/recover.c +1 -1
@@ -564,7 +564,7 @@ int dlm_recover_masters(struct dlm_ls *ls, uint64_t seq)return error; } -int dlm_recover_master_reply (struct dlm_ls *ls,struct dlm_rcom *rc) +int dlm_recover_master_reply (struct dlm_ls *ls,const struct dlm_rcom *rc) {struct dlm_rsb *r;int ret_nodeid, new_master;
fs/dlm/recover.h +1 -1
@@ -20,7 +20,7 @@ int dlm_recover_directory_wait(struct dlm_ls *ls, uint64_t seq);int dlm_recover_locks_wait (struct dlm_ls *ls,uint64_t seq);int dlm_recover_done_wait (struct dlm_ls *ls,uint64_t seq);int dlm_recover_masters (struct dlm_ls *ls,uint64_t seq); -int dlm_recover_master_reply (struct dlm_ls *ls,struct dlm_rcom *rc); +int dlm_recover_master_reply (struct dlm_ls *ls,const struct dlm_rcom *rc);int dlm_recover_locks (struct dlm_ls *ls,uint64_t seq);void dlm_recovered_lock (struct dlm_rsb *r);int dlm_create_root_list (struct dlm_ls *ls);
fs/dlm/requestqueue.c +2 -1
@@ -30,7 +30,8 @@ struct rq_entry {* lockspace is enabled on some while still suspended on others. */ -void dlm_add_requestqueue (struct dlm_ls *ls,int nodeid,struct dlm_message *ms) +void dlm_add_requestqueue (struct dlm_ls *ls,int nodeid, +const struct dlm_message *ms) {struct rq_entry *e; int length = le16_to_cpu(ms->m_header.h_length) -
fs/dlm/requestqueue.h +2 -1
@@ -11,7 +11,8 @@#ifndef __REQUESTQUEUE_DOT_H__#define __REQUESTQUEUE_DOT_H__ -void dlm_add_requestqueue (struct dlm_ls *ls,int nodeid,struct dlm_message *ms); +void dlm_add_requestqueue (struct dlm_ls *ls,int nodeid, +const struct dlm_message *ms);int dlm_process_requestqueue (struct dlm_ls *ls);void dlm_wait_requestqueue (struct dlm_ls *ls);void dlm_purge_requestqueue (struct dlm_ls *ls);
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 12/13 fs: dlm: create midcomms nodes when configure
In reply to Alexander AringThis patch puts the life of a midcomms node the same as a lowcomms connection. The lowcomms connection lifetime was changed by commit 6f0b0b5d7ae7 ("fs: dlm: remove dlm_node_addrs lookup list"). In the future the midcomms node instances can be merged with lowcomms connection structure as the lifetime is the same and states can be controlled over values or flags.
Before midcomms nodes were generated during version detection. This is not necessary anymore when the nodes are created when the cluster manager configures DLM via configfs. When a midcomms node is created over configfs it well set DLM_VERSION_NOT_SET as version. This indicates that the version of the midcomms node is still unknown and need to be probed via certain rcom messages.
--- fs/dlm/config.c | 2 +- fs/dlm/midcomms.c | 286 +++++++++++++++++----------------------------- fs/dlm/midcomms.h | 1 + 3 files changed, 110 insertions(+), 179 deletions(-)
fs/dlm/config.c +1 -1
@@ -664,7 +664,7 @@ static ssize_t comm_addr_store(struct config_item *item, const char *buf,memcpy (addr, buf, len); - rv =dlm_lowcomms_addr (cm->nodeid, addr, len); + rv =dlm_midcomms_addr (cm->nodeid, addr, len);if (rv) {kfree (addr);return rv;
fs/dlm/midcomms.c +108 -178
402 lines not on this page · raw message
fs/dlm/midcomms.h +1 -0
@@ -20,6 +20,7 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, gfp_t allocation, char **ppc);void dlm_midcomms_commit_mhandle (struct dlm_mhandle *mh,const void *name,int namelen); +int dlm_midcomms_addr (int nodeid,struct sockaddr_storage *addr,int len);void dlm_midcomms_version_wait (void );int dlm_midcomms_close (int nodeid);int dlm_midcomms_start (void );
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH v2 13/13 fs: dlm: don't use RCOM_NAMES for version detection
In reply to Alexander AringCurrently RCOM_STATUS and RCOM_NAMES inclusive their replies are being used to determine the DLM version. The RCOM_NAMES messages are triggered in DLM recovery when calling dlm_recover_directory() only. At this time the DLM version need to be determined. I ran some tests and did not expirenced some issues. When the DLM version detection was developed probably I run once in a case of RCOM_NAMES and the version was not detected yet. However it seems to be not necessary.
For backwards compatibility we still need to accept RCOM_NAMES messages which are not protected regarding the DLM message reliability layer aka stateless message. This patch changes that RCOM_NAMES we are sending out after this patch are not stateless anymore.
--- fs/dlm/rcom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/dlm/rcom.c +8 -8
@@ -308,15 +308,15 @@ static void receive_sync_reply(struct dlm_ls *ls, const struct dlm_rcom *rc_in)int dlm_rcom_names (struct dlm_ls *ls,int nodeid,char *last_name,int last_len,uint64_t seq) { +struct dlm_mhandle *mh;struct dlm_rcom *rc; -struct dlm_msg *msg;int error =0 ; ls->ls_recover_nodeid = nodeid; retry: - error =create_rcom_stateless (ls, nodeid,DLM_RCOM_NAMES , last_len, - &rc, &msg, seq); + error =create_rcom (ls, nodeid,DLM_RCOM_NAMES , last_len, + &rc, &mh, seq);if (error) goto out;memcpy (rc->rc_buf, last_name, last_len);
@@ -324,7 +324,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name,allow_sync_reply (ls, &rc->rc_id);memset (ls->ls_recover_buf,0 ,DLM_MAX_SOCKET_BUFSIZE ); -send_rcom_stateless (msg, rc); +send_rcom (mh, rc); error =dlm_wait_function (ls, &rcom_response);disallow_sync_reply (ls);
@@ -337,17 +337,17 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name,static void receive_rcom_names (struct dlm_ls *ls,const struct dlm_rcom *rc_in,uint64_t seq) { +struct dlm_mhandle *mh;struct dlm_rcom *rc;int error, inlen, outlen, nodeid; -struct dlm_msg *msg; nodeid =le32_to_cpu (rc_in->rc_header.h_nodeid); inlen =le16_to_cpu (rc_in->rc_header.h_length) -sizeof (struct dlm_rcom ); outlen =DLM_MAX_APP_BUFSIZE -sizeof (struct dlm_rcom ); - error =create_rcom_stateless (ls, nodeid,DLM_RCOM_NAMES_REPLY , outlen, - &rc, &msg, seq); + error =create_rcom (ls, nodeid,DLM_RCOM_NAMES_REPLY , outlen, + &rc, &mh, seq);if (error)return ; rc->rc_id = rc_in->rc_id;
@@ -355,7 +355,7 @@ static void receive_rcom_names(struct dlm_ls *ls, const struct dlm_rcom *rc_in,dlm_copy_master_names (ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen, nodeid); -send_rcom_stateless (msg, rc); +send_rcom (mh, rc); }int dlm_send_rcom_lookup (struct dlm_rsb *r,int dir_nodeid,uint64_t seq)
Signature · 1 line
2.31.1