File 0001-fix-concurrent-and-nfs.patch of Package ebtables.19024

From: Firo Yang @ 2021-04-16  4:11 UTC (permalink / raw)
  To: pablo, netfilter-devel; +Cc: sflees, firogm, Firo Yang

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>
---
 libebtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: ebtables-v2.0.10-4/libebtc.c
===================================================================
--- ebtables-v2.0.10-4.orig/libebtc.c
+++ ebtables-v2.0.10-4/libebtc.c
@@ -146,7 +146,7 @@ static int lock_file()
 	int fd, try = 0;
 
 retry:
-	fd = open(LOCKFILE, O_CREAT, 00600);
+	fd = open(LOCKFILE, O_CREAT|O_WRONLY, 00600);
 	if (fd < 0) {
 		if (try == 1 || mkdir(LOCKDIR, 00700))
 			return -2;
openSUSE Build Service is sponsored by