diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/transport/ChangeLog | 7 | ||||
-rw-r--r-- | runtime/transport/procfs.c | 22 | ||||
-rw-r--r-- | runtime/transport/transport.c | 5 |
3 files changed, 23 insertions, 11 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 677a22ab..6b0a7726 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,10 @@ +2006-02-17 Martin Hunt <hunt@redhat.com> + + * procfs.c (_stp_proc_read_cmd): Change spin_lock() + to spin_lock_irqsave(). + + * transport.c (_stp_work_queue): Ditto. + 2005-12-02 Martin Hunt <hunt@redhat.com> * procfs.c (_stp_set_buffers): kmalloc the buffers instead diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 7818c491..d083fb64 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -170,22 +170,23 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p { struct _stp_buffer *bptr; int len; + unsigned long flags; /* wait for nonempty ready queue */ - spin_lock(&_stp_ready_lock); + spin_lock_irqsave(&_stp_ready_lock, flags); while (list_empty(&_stp_ready_q)) { - spin_unlock(&_stp_ready_lock); + spin_unlock_irqrestore(&_stp_ready_lock, flags); if (file->f_flags & O_NONBLOCK) return -EAGAIN; if (wait_event_interruptible(_stp_proc_wq, !list_empty(&_stp_ready_q))) return -ERESTARTSYS; - spin_lock(&_stp_ready_lock); + spin_lock_irqsave(&_stp_ready_lock, flags); } /* get the next buffer off the ready list */ bptr = (struct _stp_buffer *)_stp_ready_q.next; list_del_init(&bptr->list); - spin_unlock(&_stp_ready_lock); + spin_unlock_irqrestore(&_stp_ready_lock, flags); /* write it out */ len = bptr->len + 4; @@ -198,9 +199,9 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p } /* put it on the pool of free buffers */ - spin_lock(&_stp_pool_lock); + spin_lock_irqsave(&_stp_pool_lock, flags); list_add_tail(&bptr->list, &_stp_pool_q); - spin_unlock(&_stp_pool_lock); + spin_unlock_irqrestore(&_stp_pool_lock, flags); return len; } @@ -228,13 +229,13 @@ static int _stp_set_buffers(int num) { int i; struct list_head *p; - + unsigned long flags; + //printk("stp_set_buffers %d\n", num); if (num == 0 || num == _stp_current_buffers) return _stp_current_buffers; - spin_lock(&_stp_pool_lock); if (num > _stp_current_buffers) { for (i = 0; i < num - _stp_current_buffers; i++) { p = (struct list_head *)kmalloc(sizeof(struct _stp_buffer),GFP_KERNEL); @@ -242,18 +243,21 @@ static int _stp_set_buffers(int num) _stp_current_buffers += i; goto err; } + spin_lock_irqsave(&_stp_pool_lock, flags); list_add (p, &_stp_pool_q); + spin_unlock_irqrestore(&_stp_pool_lock, flags); } } else { for (i = 0; i < _stp_current_buffers - num; i++) { + spin_lock_irqsave(&_stp_pool_lock, flags); p = _stp_pool_q.next; list_del(p); + spin_unlock_irqrestore(&_stp_pool_lock, flags); kfree(p); } } _stp_current_buffers = num; err: - spin_unlock(&_stp_pool_lock); return _stp_current_buffers; } diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index c6c4b1b4..da903f6d 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -148,11 +148,12 @@ static void _stp_cleanup_and_exit (int closing) static void _stp_work_queue (void *data) { int do_io = 0; + unsigned long flags; - spin_lock(&_stp_ready_lock); + spin_lock_irqsave(&_stp_ready_lock, flags); if (!list_empty(&_stp_ready_q)) do_io = 1; - spin_unlock(&_stp_ready_lock); + spin_unlock_irqrestore(&_stp_ready_lock, flags); if (do_io) wake_up_interruptible(&_stp_proc_wq); |