Merge tag 'fbdev-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux
[cascardo/linux.git] / fs / dlm / user.c
index 75ecc0d..173b387 100644 (file)
@@ -782,6 +782,7 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
        DECLARE_WAITQUEUE(wait, current);
        struct dlm_callback cb;
        int rv, resid, copy_lvb = 0;
+       int old_mode, new_mode;
 
        if (count == sizeof(struct dlm_device_version)) {
                rv = copy_version_to_user(buf, count);
@@ -838,6 +839,9 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
 
        lkb = list_entry(proc->asts.next, struct dlm_lkb, lkb_cb_list);
 
+       /* rem_lkb_callback sets a new lkb_last_cast */
+       old_mode = lkb->lkb_last_cast.mode;
+
        rv = dlm_rem_lkb_callback(lkb->lkb_resource->res_ls, lkb, &cb, &resid);
        if (rv < 0) {
                /* this shouldn't happen; lkb should have been removed from
@@ -861,9 +865,6 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
        }
 
        if (cb.flags & DLM_CB_CAST) {
-               int old_mode, new_mode;
-
-               old_mode = lkb->lkb_last_cast.mode;
                new_mode = cb.mode;
 
                if (!cb.sb_status && lkb->lkb_lksb->sb_lvbptr &&