Two fixes related to '--concurrent'
v2 cover Two fixes related to '--concurrent'
Fixed two problems related to '--concurrent'.
v2:
Simply print an error message suggested by Pablo Neira Ayuso.
Firo Yang (2):
libebtc: Fix an issue that '--concurrent' doesn't work with NFS
ebtables: Spewing an error if --concurrent isn't first argument
ebtables.c | 2 ++ libebtc.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
PATCH v2 1/2 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")
--- libebtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libebtc.c +1 -1
@@ -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 ;
Signature · 1 line
2.30.2
PATCH v2 2/2 ebtables: Spewing an error if --concurrent isn't first argument
In reply to Firo YangOur customer reported a following issue:
If '--concurrent' was passed to ebtables command behind other arguments, '--concurrent' will not take effect sometimes; for a simple example, ebtables -L --concurrent. This is becuase the handling of '--concurrent' is implemented in a passing-order-dependent way.
Fixed this problem as Pablo Neira Ayuso suggested by simply spewing an error like following:
./ebtables-legacy -L --concurrent
Please put the --concurrent option first.
--- ebtables.c | 2 ++ 1 file changed, 2 insertions(+)
ebtables.c +2 -0
@@ -1041,6 +1041,8 @@ big_iface_length:strcpy (replace->filename, optarg);break ;case 13 :/* concurrent */ +if (OPT_COMMANDS ) +ebt_print_error2 ("Please put the --concurrent option first" ); use_lockfd =1 ;break ;case 1 :
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerQuoted 1 line · Firo Yang
Fixed two problems related to '--concurrent'.
Series applied, thanks.