Skip to contentSkip to conversation

tuntap: correct the return value in tun_set_iff()

PATCH Applied Jason Wang 4 participants 4 messages Apr 23, 2013 – Apr 25, 2013

Subsystems (3)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 tuntap: correct the return value in tun_set_iff()

commit (3be8fbab tuntap: fix error return code in tun_set_iff()) breaks the creation of multiqueue tuntap since it forbids to create more than one queues for a multiqueue tuntap device. We need return 0 instead -EBUSY here since we don't want to re-initialize the device when one or more queues has been already attached. Add a comment and correct the return value to zero.

---
 drivers/net/tun.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/tun.c +4 -1
index 729ed53..3a8977e 100644
@@ -1594,7 +1594,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 
 		if (tun->flags & TUN_TAP_MQ &&
 		    (tun->numqueues + tun->numdisabled > 1))
-			return -EBUSY;
+			/* One or more queue has already been attached, no need
+			 * to initialize the device again.
+			 */
+			return 0;
 	}
 	else {
 		char *name;
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · Jason Wang

commit (3be8fbab tuntap: fix error return code in tun_set_iff()) breaks the creation of multiqueue tuntap since it forbids to create more than one queues for a multiqueue tuntap device. We need return 0 instead -EBUSY here since we don't want to re-initialize the device when one or more queues has been already attached. Add a comment and correct the return value to zero.

---
 drivers/net/tun.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/tun.c +4 -2
index 729ed53..3a8977e 100644
@@ -1594,7 +1594,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 
                if (tun->flags & TUN_TAP_MQ &&
                    (tun->numqueues + tun->numdisabled > 1))
-                       return -EBUSY;
+                       /* One or more queue has already been attached, no need
+                        * to initialize the device again.
+                        */
+                       return 0;
        }
        else {
                char *name;
--
Quoted 2 lines

1.7.1

Acked-by on v1 1/1
#2 lore raw
In reply to Jason Wang
Quoted 11 lines · Jason Wang

commit (3be8fbab tuntap: fix error return code in tun_set_iff()) breaks the creation of multiqueue tuntap since it forbids to create more than one queues for a multiqueue tuntap device. We need return 0 instead -EBUSY here since we don't want to re-initialize the device when one or more queues has been already attached. Add a comment and correct the return value to zero.

Quoted 27 lines
---
 drivers/net/tun.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/tun.c +4 -1
index 729ed53..3a8977e 100644
@@ -1594,7 +1594,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 
 		if (tun->flags & TUN_TAP_MQ &&
 		    (tun->numqueues + tun->numdisabled > 1))
-			return -EBUSY;
+			/* One or more queue has already been attached, no need
+			 * to initialize the device again.
+			 */
+			return 0;
 	}
 	else {
 		char *name;
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Applied
#3 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Tue, 23 Apr 2013 14:40:39 +0800

Quoted 11 lines

commit (3be8fbab tuntap: fix error return code in tun_set_iff()) breaks the creation of multiqueue tuntap since it forbids to create more than one queues for a multiqueue tuntap device. We need return 0 instead -EBUSY here since we don't want to re-initialize the device when one or more queues has been already attached. Add a comment and correct the return value to zero.

Applied.