Motr  M0
Distributed File Lock DLD

Overview

This DLD describes the implementation of a distributed file lock. The distributed file lock is implemented over Motr resource manager. Motr resource manager already provides a distributed resource management framework within a cluster (provides semantics similar to a distributed lock manager).

Purpose of a DLD
The purpose of the Detailed Level Design (DLD) specification of a distributed file lock is to:

  • Implement file lock resource type of Motr resource manager
  • Implement distributed file lock interfaces

Requirements

  • R.rm-file-lock.async The distributed file lock should provide async interfaces.
  • R.rm-file-lock.RM The distributed file lock shall use RM (resource manager) to implement the interfaces.

Logical Specification

Component Overview

The distributed file lock implements following resource manager ops:

  • resource type ops
  • resource ops
  • resource credit ops

Conformance

  • I.rm-file-lock.async The interfaces are async.
  • I.rm-file-lock.RM Implements RM ops to implement file lock resource

Unit Tests

Following scenarios will be tested:

Test:
1) Lock usage when no other thread is using the lock
  • wait mode: gets the lock
Test:
2) Lock usage when a local thread is holding the lock
  • wait mode: gets the lock when the other thread releases the lock
Test:
3) Lock usage when a remote thread is holding the lock
  • wait mode: gets the lock when the other thread releases the lock
Test:
4) lib/ut/mutex.c like test
  • A set of arbitrary thread perform lock, unlock operations. Verify the number of operations match the expected result.

System Tests

System tests will be performed by the subsystem that uses the distributed file lock.


References

  • HLD of resource manager Interfaces : For documentation links, please refer to this file : doc/motr-design-doc-list.rst


Implementation Plan

It implements:

Data Structures

Functional Specification

This section describes the data structure and the external interfaces of the distributed file lock implemented using resource manager.

Data Structures

The distributed mutex will have the following data structure:

  • m0_file This holds generic RM resource, fid and data-integrity operations supported for this file.

Subroutines

The asynchronous distributed file lock provides the functions listed in in the sub-sections below:

Constructors and Destructors

Operational Interfaces