Make ODP_DP_CREATE distinguish conflicting name from conflicting number.
authorBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 22:02:06 +0000 (14:02 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 22:02:06 +0000 (14:02 -0800)
There's no point in retrying with a different number if the name conflicts.

datapath/datapath.c
lib/dpif.c

index 85f5a6a62079c07f69c3470988fdfd5ae696cd7b..10a76786de0d6cf14e571b7cb4ae95aeb9c2a188 100644 (file)
@@ -203,8 +203,10 @@ static int create_dp(int dp_idx, const char __user *devnamep)
        if (!try_module_get(THIS_MODULE))
                goto err_unlock;
 
-       /* Exit early if a datapath with that number already exists. */
-       err = -EEXIST;
+       /* Exit early if a datapath with that number already exists.
+        * (We don't use -EEXIST because that's ambiguous with 'devname'
+        * conflicting with an existing network device name.) */
+       err = -EBUSY;
        if (get_dp(dp_idx))
                goto err_put_module;
 
index 8512ad7f3aa3c3b97fcd979c60fe33530c50ce6a..84cef19b8b784c99054d06374473e3a49a7498fe 100644 (file)
@@ -176,7 +176,7 @@ dpif_create(const char *name, struct dpif *dpif)
             error = ioctl(dpif->fd, ODP_DP_CREATE, name) < 0 ? errno : 0;
             if (!error) {
                 return 0;
-            } else if (error != EEXIST) {
+            } else if (error != EBUSY) {
                 dpif_close(dpif);
                 return error;
             }