From 59f3c790048c9036adb81d56329a66fc3ffb255a Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 13 May 2019 12:54:52 +0530 Subject: protocol/client: don't reopen fds on which POSIX locks are held after a reconnect Bricks cleanup any granted locks after a client disconnects and currently these locks are not healed after a reconnect. This means post reconnect a competing process could be granted a lock even though the first process which was granted locks has not unlocked. By not re-opening fds, subsequent operations on such fds will fail forcing the application to close the current fd and reopen a new one. This way we prevent any silent corruption. A new option "client.strict-locks" is introduced to control this behaviour. This option is set to "off" by default. Change-Id: Ieed545efea466cb5e8f5a36199aa26380c301b9e Signed-off-by: Raghavendra G updates: bz#1694920 --- xlators/protocol/client/src/client-handshake.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/protocol/client/src/client-handshake.c') diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index 649b113db14..337b2f856af 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -681,7 +681,8 @@ client_post_handshake(call_frame_t *frame, xlator_t *this) { list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos) { - if (fdctx->remote_fd != -1) + if (fdctx->remote_fd != -1 || + (!list_empty(&fdctx->lock_list) && conf->strict_locks)) continue; fdctx->reopen_done = client_child_up_reopen_done; -- cgit