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, 21 Nov 2012 04:02:26 +0000 (23:02 -0500)
commitdc2e00df1892a287eaf9ad6fad557f2cd28c90c7
treebd916ba766ca5a8fb1882df82d4916f224acd678
parent4614c11ecf8d61925b6dd17f1e6f77a4f8450297
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.

Signed-off-by: Ned Bass <bass6@llnl.gov>
LLNL-bug-id: bz1711
Change-Id: Ic00c4679cc9b813bdb47cf148bef8f62c0ef8ddb
Reviewed-on: http://review.whamcloud.com/4406
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_lib.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_idmap.c