Whamcloud - gitweb
LU-3538 dne: Commit-on-Sharing for DNE 30/12530/48
authorLai Siyao <lai.siyao@intel.com>
Sun, 2 Nov 2014 15:30:23 +0000 (23:30 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 28 Jan 2016 18:01:08 +0000 (18:01 +0000)
commitb50bb830f92e87da9bfdc84d14e4f3f78c80c9ac
tree1fb278579fbd6c51e2a06320277632bd9741e22d
parentb32e55b600ca2c9bf8b62287d9f889791d157426
LU-3538 dne: Commit-on-Sharing for DNE

This patch contains three parts:
1. Sync-on-Cancel for cross-MDT lock, which eleminates dependency
   between transactions and distributed transaction which modified
   remote object, this can guarantee the change of the distributed
   transaction will not be lost.
2. enable Commit-on-Sharing for DNE, PW/EX locks will be converted
   to COS locks, but by default they are ignored, when operation
   finds itself a distributed transaction, it will lock with
   LDLM_FL_COS_INCOMPAT flag to check against existed COS locks.
   This will eliminate dependency between distributed transaction
   and transactions which modify the same local object, and it
   guarantees distributed transaction can always be recovered.
3. striped directory creation needs to ensure its parent permanent
   on disk, to ensure this, cache child locks in mkdir.

Sync-on-Cancel for cross-MDT lock

When two operations have dependency on an object, and the first
operation has a PW/EX cross-MDT lock on this object, trigger
transaction commit on the MDT where the object resides to
eliminate dependency, in short, this patch eliminates dependency
between locks and existed PW/EX cross-MDT lock.

This patch contains following changes:
* enable Sync on Cancel for DNE by default.
* save cross-MDT lock into tgt_uncommitted_soc_locks after use,
  and it will be released upon transaction commit, note, just
  a lock refcount is taken when lock is saved, the read/write
  count is released in mdt_object_unlock().
* the saved cross-MDT lock will be discarded upon BAST,
  because the MDT where the object resides will do sync on lock
  cancel.
* use existed BLOCKING_SYNC_ON_CANCEL mechanism to commit
  transaction upon cross-MDT lock cancel.

Commit-on-Sharing for DNE

On DNE, Commit-on-Sharing is disabled by default, but MDT local
PW/EX lock will be saved as COS lock, and such lock will be
ignored in compatilibity check by default, unless it's required,
there are two situations:
1. when distributed transaction locks local object, it will
   conflict with COS locks.
2. when distributed transaction enqueues cross-MDT lock, it will
   conflict with COS locks.

This patch contains following changes:
* on DNE, local PW/EX lock is converted to COS and saved like
  before even when COS is not enabled.
* above COS locks will be ignored in lock compatibility check by
  default, so for local operations COS won't take effect. But if
  operation finds itself may modify remote MDT object, it will lock
  all local locks with COS checked.
* cross-MDT lock will always conflict with COS locks.
* if operation is reint, it will check whether it's a distributed
  operation (involved objects are remote or striped) if so, check
  against COS locks when enqueing locks.

Eliminate dependency in dir creation

Mkdir needs to take a lock on child, so that any subsequent
distributed operation using that directory would observe a conflict
and ensure that the original mkdir is committed.

Benchmark result with createmany/unlinkmany is as follows:
        mkdir rmdir open unlink mknod unlink (ops/sec)
2.6     1194 1310 1314 1185 2242 1396
master   978 1166  937 1028 1681 1202
current  930 1161  918 1018 1691 1202

* 10 createmany/unlinkmany processes running on local client
  (on MDS), 4M dirs/files created/unlinked, and the numbers are
  average of 10 processes.
* for 2.6, each process is running on a separate mountpoint.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: I91928d097cbb26bd1e1089c3f8851ac6a6440a69
Reviewed-on: http://review.whamcloud.com/12530
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
21 files changed:
lustre/contrib/wireshark/lustre_dlm_flags_wshark.c
lustre/include/lu_target.h
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_dlm.h
lustre/include/lustre_dlm_flags.h
lustre/ldlm/ldlm_inodebits.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/lod/lod_object.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lproc.c
lustre/mdt/mdt_reint.c
lustre/osp/osp_md_object.c
lustre/target/tgt_handler.c
lustre/target/tgt_internal.h
lustre/target/tgt_lastrcvd.c
lustre/target/tgt_main.c
lustre/tests/conf-sanity.sh
lustre/tests/sanityn.sh
lustre/utils/liblustreapi.c