diff options
author | David Teigland <teigland@redhat.com> | 2015-08-25 19:51:44 +0200 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-08-25 21:41:50 +0200 |
commit | b96f465035f9fae83c1d8de3e80eecfe6877608c (patch) | |
tree | 75659c1ba50859bf0b5537972f94f439f2d0867e /fs/dlm/user.c | |
parent | dlm: sctp_accept_from_sock() can be static (diff) | |
download | linux-b96f465035f9fae83c1d8de3e80eecfe6877608c.tar.xz linux-b96f465035f9fae83c1d8de3e80eecfe6877608c.zip |
dlm: fix lvb copy for user locks
For a userland lock request, the previous and current
lock modes are used to decide when the lvb should be
copied back to the user. The wrong previous value was
used, so that it always matched the current value.
This caused the lvb to be copied back to the user in
the wrong cases.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/user.c')
-rw-r--r-- | fs/dlm/user.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index fb85f32e9eca..35960502ec8d 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -785,6 +785,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); @@ -841,6 +842,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 @@ -864,9 +868,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 && |