LU-1623 mdt: Atomically update MDT export connection flags
MDT processing of connect requests currently updates the export
connection flags in two steps: client/server feature matching is
performed first, then much later various security-related bits are
removed as needed. Certain error paths may leave the export flags
partially initialized.
A problem arises if multiple connect requests from the same client are
handled out of order, as may occur due to network disruptions. If the
last such request to be handled has a lower connection count than one
that already completed, it will be aborted with -EALREADY after having
modified the connection flags in the export. However, the
security-related flags are left with incorrect values, as the
top-level connect handler skips setting these in the error path.
Replies to subsequent client requests may then contain unexpected
security information, causing the client to crash.
Similar issues may exist with other target types having non-atomic
export flag updates, and these should be addressed in follow-up
patches.
This patch makes the following changes:
- To avoid the problem described above, update the export connection
flags atomically, and only in the successful case.
- To make this important atomic operation more conspicuous, move it
from mdt_init_sec_level() to the top-level handler mdt_connect().
- Add a comment to mdt_connect_internal(), and delete a disabled code
block from it.
- Correct debug message in target_handle_connect() to match code.
port of master patch
dc2e00df1892a287eaf9ad6fad557f2cd28c90c7
Signed-off-by: Ned Bass <bass6@llnl.gov>
LLNL-bug-id: bz1711
Change-Id: Ie75ba0839c18ff8cae3bbf7358fdd30129b5a3a9
Reviewed-on: http://review.whamcloud.com/4688
Tested-by: Hudson
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>