From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id C099C5F2B for ; Fri, 16 Mar 2018 16:38:47 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id 5so3853922wmh.0 for ; Fri, 16 Mar 2018 08:38:47 -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=NiSbafwzkdvq89eA7sNkjUPTZ+W7f9CrHb0DM3d4g+o=; b=gKJ+Z8VhctbmPuoQx9bpTrYJ3NfY3z5WkTSDRZnMM0qDq10beCw3OkvHke3O80YrIw XpljH7qoZp7Jds8ZjE+tIK8mnGCTxADhrcKFjNTjtzo8B93ihfN0XWEG2B81C5n8QgwV D4YatmJC0UnU7iWLxnYxdoHbM13bk9PwnGSFLUN1O1awDjoKPGBPa2oixLdhcNWcz3sG tWcVsg3hVG3QgbnXrFcqiNu7LOvOP5awwuCHfqaJ0ilJgrJBVhdXIhRoUd1UTZRvwGID VSE4KuTrBqpqBXBDQmrz6BTnL/08sP7GabyDI3eXcZG7JZ4nSsSN/zQ1yluBZ1w1uK9J NEMQ== 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=NiSbafwzkdvq89eA7sNkjUPTZ+W7f9CrHb0DM3d4g+o=; b=Kj5krlBSOMgEXm4Vd9xVGoo0tUEMWb26T/A9xaJ6aG0Z0DwYWGKf9GUcQAFqib/5sv qH/uN6jqXBwsfi9yE0x5b7+m5tQdtzZEFzO/5AR9Sg9IF3yTSS6jEHjSoOvddUrdHsXa 1atP5CZRgLAvioXzwnQLoRElojdrGhZsd8EB7mVjVqxhwoJPSUnscR+oufurNUHJoq3W ALWYDAU6Al4FQ6i8mSnVgi98N89brfUYLWMmoJngF1XKlsnwiNKJLOuRyR8gtMzlkWui PsR5dwDZX5DHKzKlNmUd2kL1C5sHyIZG4VOgYXLC4zjhY8hzungG0tN3iOeKlj6ZhlS5 EurQ== X-Gm-Message-State: AElRT7FLP2lJt/pc5Aa+OM/4VGXwwJtkJcoPBYIH35Ct/Km3rzIjzGHf TRZbDmIRh0IEnI8+jRSWpJLWiZRmIA== X-Google-Smtp-Source: AG47ELtLCl7BeLOBXjOxKy/2v3Hgd2yyYxphLUHOs6J3LWIu/fAe/GL50+D2h2Z2793e5ETGDuyYJw== X-Received: by 10.28.112.23 with SMTP id l23mr2312251wmc.46.1521214727400; Fri, 16 Mar 2018 08:38:47 -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 a63sm9656612wrc.22.2018.03.16.08.38.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Mar 2018 08:38:46 -0700 (PDT) Date: Fri, 16 Mar 2018 16:37:44 +0100 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Xueming Li Cc: Adrien Mazarguil , Shahaf Shuler , dev@dpdk.org Message-ID: <20180316153744.lua4zr54er5v5p7g@laranjeiro-vm.dev.6wind.com> References: <20180316102748.10864-1-xuemingl@mellanox.com> <20180316152227.19813-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: <20180316152227.19813-1-xuemingl@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v1] net/mlx5: fix existing file removal 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 15:38:47 -0000 On Fri, Mar 16, 2018 at 11:22:27PM +0800, Xueming Li wrote: > There is no guarantee that the file won't be removed by external > user/application between the stat() and remove() syscalls, remove() will > fail if the file no longer exists. > > Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor") > > Signed-off-by: Xueming Li 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