netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: "Tangchen (UVP)" <tang.chen@huawei.com>
Cc: "pablo@netfilter.org" <pablo@netfilter.org>,
	"Zhangyanfei (YF)" <yanfei.zhang@huawei.com>,
	guijianfeng <guijianfeng@huawei.com>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>
Subject: Re: A bug in commit: Use flock() for --concurrent option
Date: Mon, 15 Jan 2018 16:26:41 +0100	[thread overview]
Message-ID: <20180115152641.GN14358@orbyte.nwl.cc> (raw)
In-Reply-To: <22E823DBB7698E489DC113638F747072013BD03C@dggeml511-mbx.china.huawei.com>

Hi Chen Tang,

On Fri, Jan 12, 2018 at 08:12:01AM +0000, Tangchen (UVP) wrote:
> I found a problem with this commit, 
> 
> Use flock() for --concurrent option
> The previous locking mechanism was not atomic, hence it was possible
> that a killed ebtables process would leave the lock file in place which
> in turn made future ebtables processes wait indefinitely for the lock to
> become free.
> 
> Fix this by using flock(). This also simplifies code quite a bit because
> there is no need for a custom signal handler or an __exit routine
> anymore.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> if /var/lib/ebtables/ does not exist, ebtables cannot create the lock file.
> 
> # ls /var/lib/ebtables
> ls: cannot access /var/lib/ebtables: No such file or directory
> # ebtables --concurrent -L
> Unable to create lock file /var/lib/ebtables/lock.

Thanks for reporting this! I missed that the old code calls mkdir() in
one of the error paths. Will send a follow-up patch in a moment.

Cheers, Phil

      reply	other threads:[~2018-01-15 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  8:12 A bug in commit: Use flock() for --concurrent option Tangchen (UVP)
2018-01-15 15:26 ` Phil Sutter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180115152641.GN14358@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=guijianfeng@huawei.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=tang.chen@huawei.com \
    --cc=yanfei.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).