summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFiro Yang <firo.yang@suse.com>2021-04-16 12:11:40 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2021-04-19 16:36:20 +0200
commitd696eb94e1ed49b1fce8c2da47aedbe9972cbf86 (patch)
treefa021f0a3eea943bd8eac8976d232b673d092e9b
parent46eb78ff358724f5addf14e45f2cfc31542ede3c (diff)
downloadebtables-d696eb94e1ed49b1fce8c2da47aedbe9972cbf86.tar.gz
libebtc: Fix an issue that '--concurrent' doesn't work with NFS
Due to the following commit[1] from kernel, if '/var/lib/ebtables' was mounted with a NFS filesystem, ebtables command will hit the following error: mount | grep nfs x.x.x.x:/var/lib/ebtables on /var/lib/ebtables type nfs4 [...] /usr/sbin/ebtables --concurrent -L Trying to obtain lock /var/lib/ebtables/lock Trying to obtain lock /var/lib/ebtables/lock Trying to obtain lock /var/lib/ebtables/lock Trying to obtain lock /var/lib/ebtables/lock [...] In order to fix this problem, add 'O_WRONLY' to match the requirement of that kernel commit[1]. [1]: 55725513b5ef ("NFSv4: Ensure that we check lock exclusive/shared type against open modes") Signed-off-by: Firo Yang <firo.yang@suse.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--libebtc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libebtc.c b/libebtc.c
index 1b058ef..112c307 100644
--- a/libebtc.c
+++ b/libebtc.c
@@ -144,7 +144,7 @@ static int lock_file()
int fd, try = 0;
retry:
- fd = open(LOCKFILE, O_CREAT|O_CLOEXEC, 00600);
+ fd = open(LOCKFILE, O_CREAT|O_WRONLY|O_CLOEXEC, 00600);
if (fd < 0) {
if (try == 1 || mkdir(dirname(pathbuf), 00700))
return -2;