From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 2EC475F20 for ; Fri, 16 Mar 2018 11:58:22 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id q83so2238681wme.5 for ; Fri, 16 Mar 2018 03:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=jbm6wxNTWJ0h6E7DAj9qn6OTidQCo4GgJtG88syvU+Q=; b=W2p7dimCnHEwG+yrGLYD4ov854iXpYFTwYmQWcwuXV2rJ+8Q1sclWMyueK11Xxblhy 4YxSYgesyd9EW4mPk2a+RfSTIBvErL1x83o4PMYx/cKRwvEi8p9yyjj8Yr8b+ZLzw+9R LAHBUheBYoV0h/mj9FwWCexJK/VnROiNvNL1r0RbAiAevCZLe/BLE72dVqKmYrOHqbV8 BnLTr50EgBdsg2YK9sBhJR0BKwX1l7ejfeO6HRsUDjXriZHlP9Q0rDAkvn8ExdPV8vDi aav3sGQj/nql3WN6KqdToMyaWnkkiuGyIE1MWLtso6TDEO+hJCGh9/9NTGYSnCHjC5MQ d6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=jbm6wxNTWJ0h6E7DAj9qn6OTidQCo4GgJtG88syvU+Q=; b=HohU98gukWEmY17Fd4fRLRmP3ULpfn1RrzeGFcJ60xt7SUjcy/EwhoDpCdcEelAX6D sUrHGBreO1Br7aU/JNC5rx2TfSv0XqTuKE6NWCSzWD4d9DceYQghBMiCHrUFi1DIEQZ0 +4wyuShS5QVixo8DeF6rH/QPBV7aiiOJNMFkRcLMtN+yG2oY1DZVpLmFloizoXHPh9BC HWO431D7Y06OaD6geyNHZyORECf+O6qqP6zCsXSulFQsjvQE1vSI/kZ2FHAgmqQb0okX 9wZ2rTl/MpZLd5uIxAAW5SUe+Xjj9aV/oaC57N4D/javbnTV5QGuOhLSa9evdctZWSS/ Mqdg== X-Gm-Message-State: AElRT7HAOhhmAY+8cbgrxnb6sJF+0xwSgjE+8oBw7G+rGXvQqv1e6vb6 TV+SroFDCYwDh1vRlSkTKytUnkW4lQ== X-Google-Smtp-Source: AG47ELuIl/IlKqMLpV2s/Diil7V8Ru+T09dMnDULUVb9MG0NLolwxI7IL6RDqRXHE1qkssDoFS1I4g== X-Received: by 10.28.220.2 with SMTP id t2mr1480219wmg.21.1521197901860; Fri, 16 Mar 2018 03:58:21 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x127sm4955755wmx.19.2018.03.16.03.58.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Mar 2018 03:58:21 -0700 (PDT) Date: Fri, 16 Mar 2018 11:57:18 +0100 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Xueming Li Cc: Adrien Mazarguil , Shahaf Shuler , dev@dpdk.org Message-ID: <20180316105718.cwbyod5k534uklru@laranjeiro-vm.dev.6wind.com> References: <20180316102748.10864-1-xuemingl@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180316102748.10864-1-xuemingl@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix existing file remove X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Mar 2018 10:58:23 -0000 On Fri, Mar 16, 2018 at 06:27:48PM +0800, Xueming Li wrote: > Remove file detection before removing existing file. > The explanation can induce some misunderstandings, the fact is there is no guarantee that the file won't be removed by an external user/application in between the stat() and remove() syscalls. As it cannot be done atomically there is no need to need to make such verification, remove() will fail if the file does not exists anymore. > Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor") > > Signed-off-by: Xueming Li Unless the commit log which can explain why this move is made, Acked-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_socket.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c > index 61c1a4a..fb80fb3 100644 > --- a/drivers/net/mlx5/mlx5_socket.c > +++ b/drivers/net/mlx5/mlx5_socket.c > @@ -32,7 +32,6 @@ > }; > int ret; > int flags; > - struct stat file_stat; > > /* > * Initialise the socket to communicate with the secondary > @@ -52,9 +51,7 @@ > goto out; > snprintf(sun.sun_path, sizeof(sun.sun_path), "/var/tmp/%s_%d", > MLX5_DRIVER_NAME, priv->primary_socket); > - ret = stat(sun.sun_path, &file_stat); > - if (!ret) > - claim_zero(remove(sun.sun_path)); > + remove(sun.sun_path); > ret = bind(priv->primary_socket, (const struct sockaddr *)&sun, > sizeof(sun)); > if (ret < 0) { > -- > 1.8.3.1 > -- Nélio Laranjeiro 6WIND