aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stack_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/stack_user.c')
-rw-r--r--fs/ocfs2/stack_user.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index da78a2a334fd..2dc57bca0688 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -21,11 +21,11 @@
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/miscdevice.h> 22#include <linux/miscdevice.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/slab.h>
24#include <linux/smp_lock.h> 25#include <linux/smp_lock.h>
25#include <linux/reboot.h> 26#include <linux/reboot.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27 28
28#include "ocfs2.h" /* For struct ocfs2_lock_res */
29#include "stackglue.h" 29#include "stackglue.h"
30 30
31#include <linux/dlm_plock.h> 31#include <linux/dlm_plock.h>
@@ -63,8 +63,8 @@
63 * negotiated by the client. The client negotiates based on the maximum 63 * negotiated by the client. The client negotiates based on the maximum
64 * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major 64 * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major
65 * number from the "SETV" message must match 65 * number from the "SETV" message must match
66 * ocfs2_user_plugin.sp_proto->lp_max_version.pv_major, and the minor number 66 * ocfs2_user_plugin.sp_max_proto.pv_major, and the minor number
67 * must be less than or equal to ...->lp_max_version.pv_minor. 67 * must be less than or equal to ...sp_max_version.pv_minor.
68 * 68 *
69 * Once this information has been set, mounts will be allowed. From this 69 * Once this information has been set, mounts will be allowed. From this
70 * point on, the "DOWN" message can be sent for node down notification. 70 * point on, the "DOWN" message can be sent for node down notification.
@@ -401,7 +401,7 @@ static int ocfs2_control_do_setversion_msg(struct file *file,
401 char *ptr = NULL; 401 char *ptr = NULL;
402 struct ocfs2_control_private *p = file->private_data; 402 struct ocfs2_control_private *p = file->private_data;
403 struct ocfs2_protocol_version *max = 403 struct ocfs2_protocol_version *max =
404 &ocfs2_user_plugin.sp_proto->lp_max_version; 404 &ocfs2_user_plugin.sp_max_proto;
405 405
406 if (ocfs2_control_get_handshake_state(file) != 406 if (ocfs2_control_get_handshake_state(file) !=
407 OCFS2_CONTROL_HANDSHAKE_PROTOCOL) 407 OCFS2_CONTROL_HANDSHAKE_PROTOCOL)
@@ -664,18 +664,10 @@ static void ocfs2_control_exit(void)
664 -rc); 664 -rc);
665} 665}
666 666
667static struct dlm_lksb *fsdlm_astarg_to_lksb(void *astarg)
668{
669 struct ocfs2_lock_res *res = astarg;
670 return &res->l_lksb.lksb_fsdlm;
671}
672
673static void fsdlm_lock_ast_wrapper(void *astarg) 667static void fsdlm_lock_ast_wrapper(void *astarg)
674{ 668{
675 struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); 669 struct ocfs2_dlm_lksb *lksb = astarg;
676 int status = lksb->sb_status; 670 int status = lksb->lksb_fsdlm.sb_status;
677
678 BUG_ON(ocfs2_user_plugin.sp_proto == NULL);
679 671
680 /* 672 /*
681 * For now we're punting on the issue of other non-standard errors 673 * For now we're punting on the issue of other non-standard errors
@@ -688,25 +680,24 @@ static void fsdlm_lock_ast_wrapper(void *astarg)
688 */ 680 */
689 681
690 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) 682 if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL)
691 ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0); 683 lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, 0);
692 else 684 else
693 ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg); 685 lksb->lksb_conn->cc_proto->lp_lock_ast(lksb);
694} 686}
695 687
696static void fsdlm_blocking_ast_wrapper(void *astarg, int level) 688static void fsdlm_blocking_ast_wrapper(void *astarg, int level)
697{ 689{
698 BUG_ON(ocfs2_user_plugin.sp_proto == NULL); 690 struct ocfs2_dlm_lksb *lksb = astarg;
699 691
700 ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level); 692 lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level);
701} 693}
702 694
703static int user_dlm_lock(struct ocfs2_cluster_connection *conn, 695static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
704 int mode, 696 int mode,
705 union ocfs2_dlm_lksb *lksb, 697 struct ocfs2_dlm_lksb *lksb,
706 u32 flags, 698 u32 flags,
707 void *name, 699 void *name,
708 unsigned int namelen, 700 unsigned int namelen)
709 void *astarg)
710{ 701{
711 int ret; 702 int ret;
712 703
@@ -716,36 +707,35 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
716 707
717 ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, 708 ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
718 flags|DLM_LKF_NODLCKWT, name, namelen, 0, 709 flags|DLM_LKF_NODLCKWT, name, namelen, 0,
719 fsdlm_lock_ast_wrapper, astarg, 710 fsdlm_lock_ast_wrapper, lksb,
720 fsdlm_blocking_ast_wrapper); 711 fsdlm_blocking_ast_wrapper);
721 return ret; 712 return ret;
722} 713}
723 714
724static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, 715static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
725 union ocfs2_dlm_lksb *lksb, 716 struct ocfs2_dlm_lksb *lksb,
726 u32 flags, 717 u32 flags)
727 void *astarg)
728{ 718{
729 int ret; 719 int ret;
730 720
731 ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, 721 ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
732 flags, &lksb->lksb_fsdlm, astarg); 722 flags, &lksb->lksb_fsdlm, lksb);
733 return ret; 723 return ret;
734} 724}
735 725
736static int user_dlm_lock_status(union ocfs2_dlm_lksb *lksb) 726static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
737{ 727{
738 return lksb->lksb_fsdlm.sb_status; 728 return lksb->lksb_fsdlm.sb_status;
739} 729}
740 730
741static int user_dlm_lvb_valid(union ocfs2_dlm_lksb *lksb) 731static int user_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb)
742{ 732{
743 int invalid = lksb->lksb_fsdlm.sb_flags & DLM_SBF_VALNOTVALID; 733 int invalid = lksb->lksb_fsdlm.sb_flags & DLM_SBF_VALNOTVALID;
744 734
745 return !invalid; 735 return !invalid;
746} 736}
747 737
748static void *user_dlm_lvb(union ocfs2_dlm_lksb *lksb) 738static void *user_dlm_lvb(struct ocfs2_dlm_lksb *lksb)
749{ 739{
750 if (!lksb->lksb_fsdlm.sb_lvbptr) 740 if (!lksb->lksb_fsdlm.sb_lvbptr)
751 lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb + 741 lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
@@ -753,7 +743,7 @@ static void *user_dlm_lvb(union ocfs2_dlm_lksb *lksb)
753 return (void *)(lksb->lksb_fsdlm.sb_lvbptr); 743 return (void *)(lksb->lksb_fsdlm.sb_lvbptr);
754} 744}
755 745
756static void user_dlm_dump_lksb(union ocfs2_dlm_lksb *lksb) 746static void user_dlm_dump_lksb(struct ocfs2_dlm_lksb *lksb)
757{ 747{
758} 748}
759 749