Whamcloud - gitweb
LU-1623 mdt: Atomically update MDT export connection flags
authorNed Bass <bass6@llnl.gov>
Fri, 26 Oct 2012 22:32:26 +0000 (15:32 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Nov 2012 16:00:20 +0000 (11:00 -0500)
commit45cb8ced9c25016bca7dad16016a7e4d9b0580d8
tree96676f85821d7673926e18cad61e2c9547b3c57d
parent2ff8975a6925e51ec46636bd1474fe418ea28383
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>
lustre/ldlm/ldlm_lib.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_idmap.c