From: Ben Pfaff Date: Fri, 6 Mar 2009 22:02:06 +0000 (-0800) Subject: Make ODP_DP_CREATE distinguish conflicting name from conflicting number. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6e4b5ef2f8dbf0bc70017f7a22e7b1b151a0296;p=openvswitch Make ODP_DP_CREATE distinguish conflicting name from conflicting number. There's no point in retrying with a different number if the name conflicts. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 85f5a6a6..10a76786 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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; diff --git a/lib/dpif.c b/lib/dpif.c index 8512ad7f..84cef19b 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -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; }