Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61622
b: refs/heads/master
c: 8706551
h: refs/heads/master
v: v3
  • Loading branch information
Jan Harkes authored and Linus Torvalds committed Jul 19, 2007
1 parent 56f1010 commit bd4bd5d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ed31a7dd636b296746c131b7386023aa1ef84309
refs/heads/master: 87065519633af79e0577e32a58dcd9cf3c45a8a0
61 changes: 30 additions & 31 deletions trunk/fs/coda/psdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,56 +272,51 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf,

static int coda_psdev_open(struct inode * inode, struct file * file)
{
struct venus_comm *vcp;
int idx;
struct venus_comm *vcp;
int idx, err;

lock_kernel();
idx = iminor(inode);
if(idx >= MAX_CODADEVS) {
unlock_kernel();
if (idx < 0 || idx >= MAX_CODADEVS)
return -ENODEV;
}

lock_kernel();

err = -EBUSY;
vcp = &coda_comms[idx];
if(vcp->vc_inuse) {
unlock_kernel();
return -EBUSY;
}

if (!vcp->vc_inuse++) {
if (!vcp->vc_inuse) {
vcp->vc_inuse++;

INIT_LIST_HEAD(&vcp->vc_pending);
INIT_LIST_HEAD(&vcp->vc_processing);
init_waitqueue_head(&vcp->vc_waitq);
vcp->vc_sb = NULL;
vcp->vc_seq = 0;

file->private_data = vcp;
err = 0;
}

file->private_data = vcp;

unlock_kernel();
return 0;
return err;
}


static int coda_psdev_release(struct inode * inode, struct file * file)
{
struct venus_comm *vcp = (struct venus_comm *) file->private_data;
struct upc_req *req, *tmp;
struct venus_comm *vcp = (struct venus_comm *) file->private_data;
struct upc_req *req, *tmp;

lock_kernel();
if ( !vcp->vc_inuse ) {
unlock_kernel();
if (!vcp || !vcp->vc_inuse ) {
printk("psdev_release: Not open.\n");
return -1;
}

if (--vcp->vc_inuse) {
unlock_kernel();
return 0;
}

/* Wakeup clients so they can return. */
lock_kernel();

/* Wakeup clients so they can return. */
list_for_each_entry_safe(req, tmp, &vcp->vc_pending, uc_chain) {
list_del(&req->uc_chain);

/* Async requests need to be freed here */
if (req->uc_flags & REQ_ASYNC) {
CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr));
Expand All @@ -330,13 +325,17 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
}
req->uc_flags |= REQ_ABORT;
wake_up(&req->uc_sleep);
}

list_for_each_entry(req, &vcp->vc_processing, uc_chain) {
}

list_for_each_entry_safe(req, tmp, &vcp->vc_processing, uc_chain) {
list_del(&req->uc_chain);

req->uc_flags |= REQ_ABORT;
wake_up(&req->uc_sleep);
}
wake_up(&req->uc_sleep);
}

file->private_data = NULL;
vcp->vc_inuse--;
unlock_kernel();
return 0;
}
Expand Down
9 changes: 2 additions & 7 deletions trunk/fs/coda/upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
*
*/

static inline void coda_waitfor_upcall(struct upc_req *vmp,
struct venus_comm *vcommp)
static inline void coda_waitfor_upcall(struct upc_req *vmp)
{
DECLARE_WAITQUEUE(wait, current);

Expand All @@ -655,10 +654,6 @@ static inline void coda_waitfor_upcall(struct upc_req *vmp,
else
set_current_state(TASK_UNINTERRUPTIBLE);

/* venus died */
if ( !vcommp->vc_inuse )
break;

/* got a reply */
if ( vmp->uc_flags & ( REQ_WRITE | REQ_ABORT ) )
break;
Expand Down Expand Up @@ -738,7 +733,7 @@ static int coda_upcall(struct coda_sb_info *sbi,
* ENODEV. */

/* Go to sleep. Wake up on signals only after the timeout. */
coda_waitfor_upcall(req, vcommp);
coda_waitfor_upcall(req);

if (vcommp->vc_inuse) { /* i.e. Venus is still alive */
/* Op went through, interrupt or not... */
Expand Down

0 comments on commit bd4bd5d

Please sign in to comment.