dlm: trivial annotation of be16 value
[safe/jmp/linux-2.6] / fs / dlm / lock.c
index 94f8cbd..724ddac 100644 (file)
@@ -165,7 +165,7 @@ void dlm_print_lkb(struct dlm_lkb *lkb)
               lkb->lkb_grmode, lkb->lkb_wait_type, lkb->lkb_ast_type);
 }
 
-void dlm_print_rsb(struct dlm_rsb *r)
+static void dlm_print_rsb(struct dlm_rsb *r)
 {
        printk(KERN_ERR "rsb: nodeid %d flags %lx first %x rlc %d name %s\n",
               r->res_nodeid, r->res_flags, r->res_first_lkid,
@@ -363,6 +363,7 @@ static int search_rsb_list(struct list_head *head, char *name, int len,
                if (len == r->res_length && !memcmp(name, r->res_name, len))
                        goto found;
        }
+       *r_ret = NULL;
        return -EBADR;
 
  found:
@@ -1782,7 +1783,8 @@ static void grant_pending_locks(struct dlm_rsb *r)
 
        list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) {
                if (lkb->lkb_bastfn && lock_requires_bast(lkb, high, cw)) {
-                       if (cw && high == DLM_LOCK_PR)
+                       if (cw && high == DLM_LOCK_PR &&
+                           lkb->lkb_grmode == DLM_LOCK_PR)
                                queue_bast(r, lkb, DLM_LOCK_CW);
                        else
                                queue_bast(r, lkb, high);
@@ -1956,8 +1958,7 @@ static void confirm_master(struct dlm_rsb *r, int error)
                        list_del_init(&lkb->lkb_rsb_lookup);
                        r->res_first_lkid = lkb->lkb_id;
                        _request_lock(r, lkb);
-               } else
-                       r->res_nodeid = -1;
+               }
                break;
 
        default:
@@ -4533,7 +4534,7 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
        /* user can change the params on its lock when it converts it, or
           add an lvb that didn't exist before */
 
-       ua = (struct dlm_user_args *)lkb->lkb_astparam;
+       ua = lkb->lkb_ua;
 
        if (flags & DLM_LKF_VALBLK && !ua->lksb.sb_lvbptr) {
                ua->lksb.sb_lvbptr = kzalloc(DLM_USER_LVB_LEN, GFP_KERNEL);
@@ -4584,7 +4585,7 @@ int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
        if (error)
                goto out;
 
-       ua = (struct dlm_user_args *)lkb->lkb_astparam;
+       ua = lkb->lkb_ua;
 
        if (lvb_in && ua->lksb.sb_lvbptr)
                memcpy(ua->lksb.sb_lvbptr, lvb_in, DLM_USER_LVB_LEN);
@@ -4633,7 +4634,7 @@ int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
        if (error)
                goto out;
 
-       ua = (struct dlm_user_args *)lkb->lkb_astparam;
+       ua = lkb->lkb_ua;
        if (ua_tmp->castparam)
                ua->castparam = ua_tmp->castparam;
        ua->user_lksb = ua_tmp->user_lksb;
@@ -4671,7 +4672,7 @@ int dlm_user_deadlock(struct dlm_ls *ls, uint32_t flags, uint32_t lkid)
        if (error)
                goto out;
 
-       ua = (struct dlm_user_args *)lkb->lkb_astparam;
+       ua = lkb->lkb_ua;
 
        error = set_unlock_args(flags, ua, &args);
        if (error)
@@ -4710,7 +4711,6 @@ int dlm_user_deadlock(struct dlm_ls *ls, uint32_t flags, uint32_t lkid)
 
 static int orphan_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb)
 {
-       struct dlm_user_args *ua = (struct dlm_user_args *)lkb->lkb_astparam;
        struct dlm_args args;
        int error;
 
@@ -4719,7 +4719,7 @@ static int orphan_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb)
        list_add_tail(&lkb->lkb_ownqueue, &ls->ls_orphans);
        mutex_unlock(&ls->ls_orphans_mutex);
 
-       set_unlock_args(0, ua, &args);
+       set_unlock_args(0, lkb->lkb_ua, &args);
 
        error = cancel_lock(ls, lkb, &args);
        if (error == -DLM_ECANCEL)
@@ -4732,11 +4732,10 @@ static int orphan_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb)
 
 static int unlock_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb)
 {
-       struct dlm_user_args *ua = (struct dlm_user_args *)lkb->lkb_astparam;
        struct dlm_args args;
        int error;
 
-       set_unlock_args(DLM_LKF_FORCEUNLOCK, ua, &args);
+       set_unlock_args(DLM_LKF_FORCEUNLOCK, lkb->lkb_ua, &args);
 
        error = unlock_lock(ls, lkb, &args);
        if (error == -DLM_EUNLOCK)