Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84703
b: refs/heads/master
c: cf446f0
h: refs/heads/master
i:
  84701: e8011b8
  84699: 41b95d2
  84695: 01c6564
  84687: f38c5e0
  84671: b1f82ca
v: v3
  • Loading branch information
Ed L. Cashin authored and Linus Torvalds committed Feb 8, 2008
1 parent 55e0a89 commit a4cee3c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 36 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: 468fc53050a81d73893ce619a62914799e8d86bb
refs/heads/master: cf446f0dbafb5428a551da1c0df8f56316831df8
69 changes: 34 additions & 35 deletions trunk/drivers/block/aoe/aoechr.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,52 +194,51 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
ulong flags;

n = (unsigned long) filp->private_data;
switch (n) {
case MINOR_ERR:
spin_lock_irqsave(&emsgs_lock, flags);
loop:
em = emsgs + emsgs_head_idx;
if ((em->flags & EMFL_VALID) == 0) {
if (filp->f_flags & O_NDELAY) {
spin_unlock_irqrestore(&emsgs_lock, flags);
return -EAGAIN;
}
nblocked_emsgs_readers++;
if (n != MINOR_ERR)
return -EFAULT;

spin_lock_irqsave(&emsgs_lock, flags);

for (;;) {
em = emsgs + emsgs_head_idx;
if ((em->flags & EMFL_VALID) != 0)
break;
if (filp->f_flags & O_NDELAY) {
spin_unlock_irqrestore(&emsgs_lock, flags);
return -EAGAIN;
}
nblocked_emsgs_readers++;

spin_unlock_irqrestore(&emsgs_lock, flags);

n = down_interruptible(&emsgs_sema);
n = down_interruptible(&emsgs_sema);

spin_lock_irqsave(&emsgs_lock, flags);
spin_lock_irqsave(&emsgs_lock, flags);

nblocked_emsgs_readers--;
nblocked_emsgs_readers--;

if (n) {
spin_unlock_irqrestore(&emsgs_lock, flags);
return -ERESTARTSYS;
}
goto loop;
}
if (em->len > cnt) {
if (n) {
spin_unlock_irqrestore(&emsgs_lock, flags);
return -EAGAIN;
return -ERESTARTSYS;
}
mp = em->msg;
len = em->len;
em->msg = NULL;
em->flags &= ~EMFL_VALID;
}
if (em->len > cnt) {
spin_unlock_irqrestore(&emsgs_lock, flags);
return -EAGAIN;
}
mp = em->msg;
len = em->len;
em->msg = NULL;
em->flags &= ~EMFL_VALID;

emsgs_head_idx++;
emsgs_head_idx %= ARRAY_SIZE(emsgs);
emsgs_head_idx++;
emsgs_head_idx %= ARRAY_SIZE(emsgs);

spin_unlock_irqrestore(&emsgs_lock, flags);
spin_unlock_irqrestore(&emsgs_lock, flags);

n = copy_to_user(buf, mp, len);
kfree(mp);
return n == 0 ? len : -EFAULT;
default:
return -EFAULT;
}
n = copy_to_user(buf, mp, len);
kfree(mp);
return n == 0 ? len : -EFAULT;
}

static const struct file_operations aoe_fops = {
Expand Down

0 comments on commit a4cee3c

Please sign in to comment.