user.c (cb79f1998d89821a4dbac47f59a46ee3fbbf3c61) user.c (d292c0cc489fa642799494bddbd7c94d11f7bbc1)
1/*
2 * Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8

--- 181 unchanged lines hidden (view full) ---

190 can't be delivered. For ORPHAN's, dlm_clear_proc_locks() freed
191 lkb->ua so we can't try to use it. This second check is necessary
192 for cases where a completion ast is received for an operation that
193 began before clear_proc_locks did its cancel/unlock. */
194
195 if (lkb->lkb_flags & (DLM_IFL_ORPHAN | DLM_IFL_DEAD))
196 goto out;
197
1/*
2 * Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8

--- 181 unchanged lines hidden (view full) ---

190 can't be delivered. For ORPHAN's, dlm_clear_proc_locks() freed
191 lkb->ua so we can't try to use it. This second check is necessary
192 for cases where a completion ast is received for an operation that
193 began before clear_proc_locks did its cancel/unlock. */
194
195 if (lkb->lkb_flags & (DLM_IFL_ORPHAN | DLM_IFL_DEAD))
196 goto out;
197
198 DLM_ASSERT(lkb->lkb_astparam, dlm_print_lkb(lkb););
199 ua = (struct dlm_user_args *)lkb->lkb_astparam;
198 DLM_ASSERT(lkb->lkb_ua, dlm_print_lkb(lkb););
199 ua = lkb->lkb_ua;
200 proc = ua->proc;
201
202 if (type == AST_BAST && ua->bastaddr == NULL)
203 goto out;
204
205 spin_lock(&proc->asts_spin);
206
207 ast_type = lkb->lkb_ast_type;

--- 558 unchanged lines hidden (view full) ---

766
767/* a read returns a single ast described in a struct dlm_lock_result */
768
769static ssize_t device_read(struct file *file, char __user *buf, size_t count,
770 loff_t *ppos)
771{
772 struct dlm_user_proc *proc = file->private_data;
773 struct dlm_lkb *lkb;
200 proc = ua->proc;
201
202 if (type == AST_BAST && ua->bastaddr == NULL)
203 goto out;
204
205 spin_lock(&proc->asts_spin);
206
207 ast_type = lkb->lkb_ast_type;

--- 558 unchanged lines hidden (view full) ---

766
767/* a read returns a single ast described in a struct dlm_lock_result */
768
769static ssize_t device_read(struct file *file, char __user *buf, size_t count,
770 loff_t *ppos)
771{
772 struct dlm_user_proc *proc = file->private_data;
773 struct dlm_lkb *lkb;
774 struct dlm_user_args *ua;
775 DECLARE_WAITQUEUE(wait, current);
776 int error, type=0, bmode=0, removed = 0;
777
778 if (count == sizeof(struct dlm_device_version)) {
779 error = copy_version_to_user(buf, count);
780 return error;
781 }
782

--- 54 unchanged lines hidden (view full) ---

837 }
838
839 if (!lkb->lkb_ast_type) {
840 list_del(&lkb->lkb_astqueue);
841 removed = 1;
842 }
843 spin_unlock(&proc->asts_spin);
844
774 DECLARE_WAITQUEUE(wait, current);
775 int error, type=0, bmode=0, removed = 0;
776
777 if (count == sizeof(struct dlm_device_version)) {
778 error = copy_version_to_user(buf, count);
779 return error;
780 }
781

--- 54 unchanged lines hidden (view full) ---

836 }
837
838 if (!lkb->lkb_ast_type) {
839 list_del(&lkb->lkb_astqueue);
840 removed = 1;
841 }
842 spin_unlock(&proc->asts_spin);
843
845 ua = (struct dlm_user_args *)lkb->lkb_astparam;
846 error = copy_result_to_user(ua,
844 error = copy_result_to_user(lkb->lkb_ua,
847 test_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags),
848 type, bmode, buf, count);
849
850 /* removes reference for the proc->asts lists added by
851 dlm_user_add_ast() and may result in the lkb being freed */
852 if (removed)
853 dlm_put_lkb(lkb);
854

--- 68 unchanged lines hidden ---
845 test_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags),
846 type, bmode, buf, count);
847
848 /* removes reference for the proc->asts lists added by
849 dlm_user_add_ast() and may result in the lkb being freed */
850 if (removed)
851 dlm_put_lkb(lkb);
852

--- 68 unchanged lines hidden ---