aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoechr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/aoe/aoechr.c')
-rw-r--r--drivers/block/aoe/aoechr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index e86d2062a164..ed57a890c643 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ 1/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
2/* 2/*
3 * aoechr.c 3 * aoechr.c
4 * AoE character device driver 4 * AoE character device driver
@@ -86,34 +86,34 @@ revalidate(const char __user *str, size_t size)
86 if (copy_from_user(buf, str, size)) 86 if (copy_from_user(buf, str, size))
87 return -EFAULT; 87 return -EFAULT;
88 88
89 /* should be e%d.%d format */
90 n = sscanf(buf, "e%d.%d", &major, &minor); 89 n = sscanf(buf, "e%d.%d", &major, &minor);
91 if (n != 2) { 90 if (n != 2) {
92 printk(KERN_ERR "aoe: invalid device specification\n"); 91 pr_err("aoe: invalid device specification %s\n", buf);
93 return -EINVAL; 92 return -EINVAL;
94 } 93 }
95 d = aoedev_by_aoeaddr(major, minor); 94 d = aoedev_by_aoeaddr(major, minor, 0);
96 if (!d) 95 if (!d)
97 return -EINVAL; 96 return -EINVAL;
98 spin_lock_irqsave(&d->lock, flags); 97 spin_lock_irqsave(&d->lock, flags);
99 aoecmd_cleanslate(d); 98 aoecmd_cleanslate(d);
99 aoecmd_cfg(major, minor);
100loop: 100loop:
101 skb = aoecmd_ata_id(d); 101 skb = aoecmd_ata_id(d);
102 spin_unlock_irqrestore(&d->lock, flags); 102 spin_unlock_irqrestore(&d->lock, flags);
103 /* try again if we are able to sleep a bit, 103 /* try again if we are able to sleep a bit,
104 * otherwise give up this revalidation 104 * otherwise give up this revalidation
105 */ 105 */
106 if (!skb && !msleep_interruptible(200)) { 106 if (!skb && !msleep_interruptible(250)) {
107 spin_lock_irqsave(&d->lock, flags); 107 spin_lock_irqsave(&d->lock, flags);
108 goto loop; 108 goto loop;
109 } 109 }
110 aoedev_put(d);
110 if (skb) { 111 if (skb) {
111 struct sk_buff_head queue; 112 struct sk_buff_head queue;
112 __skb_queue_head_init(&queue); 113 __skb_queue_head_init(&queue);
113 __skb_queue_tail(&queue, skb); 114 __skb_queue_tail(&queue, skb);
114 aoenet_xmit(&queue); 115 aoenet_xmit(&queue);
115 } 116 }
116 aoecmd_cfg(major, minor);
117 return 0; 117 return 0;
118} 118}
119 119
@@ -174,6 +174,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
174 break; 174 break;
175 case MINOR_FLUSH: 175 case MINOR_FLUSH:
176 ret = aoedev_flush(buf, cnt); 176 ret = aoedev_flush(buf, cnt);
177 break;
177 } 178 }
178 if (ret == 0) 179 if (ret == 0)
179 ret = cnt; 180 ret = cnt;