요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
=====
DLMFS
=====
A minimal DLM userspace interface implemented via a virtual file
system.
dlmfs is built with OCFS2 as it requires most of its infrastructure.
:Project web page: http://ocfs2.wiki.kernel.org
:Tools web page: https://github.com/markfasheh/ocfs2-tools
:OCFS2 mailing lists: https://subspace.kernel.org/lists.linux.dev.html
All code copyright 2005 Oracle except when otherwise noted.
Credits
=======
Some code taken from ramfs which is Copyright |copy| 2000 Linus Torvalds
and Transmeta Corp.
Mark Fasheh <[email protected]>
Caveats
=======
- Right now it only works with the OCFS2 DLM, though support for other
DLM implementations should not be a major issue.
Mount options
=============
None
Usage
=====
If you're just interested in OCFS2, then please see ocfs2.rst. The
rest of this document will be geared towards those who want to use
dlmfs for easy to setup and easy to use clustered locking in
userspace.
Setup
=====
dlmfs requires that the OCFS2 cluster infrastructure be in
place. Please download ocfs2-tools from the above url and configure a
cluster.
You'll want to start heartbeating on a volume which all the nodes in
your lockspace can access. The easiest way to do this is via
ocfs2_hb_ctl (distributed with ocfs2-tools). Right now it requires
that an OCFS2 file system be in place so that it can automatically
find its heartbeat area, though it will eventually support heartbeat
against raw disks.
Please see the ocfs2_hb_ctl and mkfs.ocfs2 manual pages distributed
with ocfs2-tools.
Once you're heartbeating, DLM lock 'domains' can be easily created /
destroyed and locks within them accessed.
Locking
=======
Users may access dlmfs via standard file system calls, or they can use
'libo2dlm' (distributed with ocfs2-tools) which abstracts the file
system calls and presents a more traditional locking api.
dlmfs handles lock caching automatically for the user, so a lock
request for an already acquired lock will not generate another DLM
call. Userspace programs are assumed to handle their own local
locking.
Two levels of locks are supported - Shared Read, and Exclusive.
Also supported is a Trylock operation.
For information on the libo2dlm interface, please see o2dlm.h,
distributed with ocfs2-tools.
Lock value blocks can be read and written to a resource via read(2)
and write(2) against the fd obtained via your open(2) call. The
maximum currently supported LVB length is 64 bytes (though that is an
OCFS2 DLM limitation). Through this mechanism, users of dlmfs can share
small amounts of data amongst their nodes.
mkdir(2) signals dlmfs to join a domain (which will have the same name
as the resulting directory)
rmdir(2) signals dlmfs to leave the domain
Locks for a given domain are represented by regular inodes inside the
domain directory. Locking against them is done via the open(2) system
call.
The open(2) call will not return until your lock has been granted or
an error has occurred, unless it has been instructed to do a trylock
operation. If the lock succeeds, you'll get an fd.
open(2) with O_CREAT to ensure the resource inode is created - dlmfs does
not automatically create inodes for existing lock resources.
============ ===========================
Open Flag Lock Request Type
============ ===========================
O_RDONLY Shared Read
O_RDWR Exclusive
============ ===========================
============ ===========================
Open Flag Resulting Locking Behavior
============ ===========================
O_NONBLOCK Trylock operation
============ ===========================
You must provide exactly one of O_RDONLY or O_RDWR.
If O_NONBLOCK is also provided and the trylock operation was valid but
could not lock the resource then open(2) will return ETXTBUSY.
close(2) drops the lock associated with your fd.
Modes passed to mkdir(2) or open(2) are adhered to locally. Chown is
supported locally as well. This means you can use them to restrict
access to the resources via dlmfs on your local node only.
The resource LVB may be read from the fd in either Shared Read or
Exclusive modes via the read(2) system call. It can be written via
write(2) only when open in Exclusive mode.
Once written, an LVB will be visible to other nodes who obtain Read
Only or higher level locks on the resource.
See Also
========
http://opendlm.sourceforge.net/cvsmirror/opendlm/docs/dlmbook_final.pdf
For more information on the VMS distributed locking API.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
DLMFS 개요, 제약과 mount option
1-34dlmfs는 virtual filesystem을 통해 구현한 최소 DLM userspace interface입니다. OCFS2 infrastructure 대부분을 필요로 하므로 OCFS2와 함께 빌드됩니다.
프로젝트 정보는 `http://ocfs2.wiki.kernel.org`, 도구는 `https://github.com/markfasheh/ocfs2-tools`, mailing list는 `https://subspace.kernel.org/lists.linux.dev.html`에서 확인합니다. 별도 표기가 없는 코드는 2005 Oracle 저작권이며 일부 ramfs 코드는 Linus Torvalds와 Transmeta Corp.의 2000년 코드에서 가져왔습니다.
현재는 OCFS2 DLM에서만 동작합니다. 다른 DLM 구현 지원이 큰 문제는 아닐 것으로 예상하지만 아직 제공되지 않습니다. dlmfs에는 mount option이 없습니다.
userspace filesystem interface가 OCFS2 cluster infrastructure에 기대는 관계입니다.
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
=====
DLMFS
=====
A minimal DLM userspace interface implemented via a virtual file
system.
dlmfs is built with OCFS2 as it requires most of its infrastructure.
:Project web page: http://ocfs2.wiki.kernel.org
:Tools web page: https://github.com/markfasheh/ocfs2-tools
:OCFS2 mailing lists: https://subspace.kernel.org/lists.linux.dev.html
All code copyright 2005 Oracle except when otherwise noted.
Credits
=======
Some code taken from ramfs which is Copyright |copy| 2000 Linus Torvalds
and Transmeta Corp.
Mark Fasheh <[email protected]>
Caveats
=======
- Right now it only works with the OCFS2 DLM, though support for other
DLM implementations should not be a major issue.
Mount options
=============
None
Cluster와 heartbeat 설정
35-63OCFS2 filesystem 자체가 목적이면 `ocfs2.rst`를 참고합니다. 이 문서의 나머지는 userspace에서 쉽게 구성하고 사용할 수 있는 clustered locking을 위해 dlmfs를 쓰는 사용자를 대상으로 합니다.
먼저 OCFS2 cluster infrastructure를 구성해야 합니다. 위 URL에서 `ocfs2-tools`를 내려받아 cluster를 설정합니다.
lockspace의 모든 node가 접근할 수 있는 volume에서 heartbeat를 시작해야 합니다. 가장 간단한 방법은 ocfs2-tools에 포함된 `ocfs2_hb_ctl`입니다. 현재 이 도구는 heartbeat area를 자동으로 찾기 위해 OCFS2 filesystem이 있어야 하지만, 장차 raw disk heartbeat도 지원할 예정입니다.
세부 절차는 ocfs2-tools의 `ocfs2_hb_ctl`과 `mkfs.ocfs2` manual page를 참고합니다. heartbeat가 시작되면 DLM lock domain을 손쉽게 만들고 제거하며 그 안의 lock에 접근할 수 있습니다.
cluster infrastructure에서 lock domain을 사용할 수 있게 되는 단계입니다.
Usage
=====
If you're just interested in OCFS2, then please see ocfs2.rst. The
rest of this document will be geared towards those who want to use
dlmfs for easy to setup and easy to use clustered locking in
userspace.
Setup
=====
dlmfs requires that the OCFS2 cluster infrastructure be in
place. Please download ocfs2-tools from the above url and configure a
cluster.
You'll want to start heartbeating on a volume which all the nodes in
your lockspace can access. The easiest way to do this is via
ocfs2_hb_ctl (distributed with ocfs2-tools). Right now it requires
that an OCFS2 file system be in place so that it can automatically
find its heartbeat area, though it will eventually support heartbeat
against raw disks.
Please see the ocfs2_hb_ctl and mkfs.ocfs2 manual pages distributed
with ocfs2-tools.
Once you're heartbeating, DLM lock 'domains' can be easily created /
destroyed and locks within them accessed.
Lock caching, mode와 LVB
64-86사용자는 표준 filesystem call로 dlmfs에 접근하거나 ocfs2-tools의 `libo2dlm`을 사용할 수 있습니다. libo2dlm은 filesystem call을 감추고 전통적인 locking API를 제공합니다.
dlmfs는 lock caching을 자동 처리합니다. 이미 획득한 lock을 다시 요청해도 DLM call을 새로 만들지 않습니다. 다만 같은 node 안의 local locking은 userspace program이 직접 처리한다고 가정합니다.
지원되는 lock level은 Shared Read와 Exclusive 두 가지이며 Trylock operation도 제공합니다. libo2dlm interface는 ocfs2-tools의 `o2dlm.h`를 참고합니다.
`open(2)`으로 얻은 fd에 `read(2)`와 `write(2)`를 수행하면 lock value block(LVB)을 읽고 쓸 수 있습니다. 현재 최대 LVB 길이는 64 bytes이며 이는 OCFS2 DLM의 제한입니다. 이 방식으로 node 사이에 소량의 데이터를 공유할 수 있습니다.
lock mode와 별도로 LVB가 제공하는 작은 공유 데이터 영역을 구분합니다.
Locking
=======
Users may access dlmfs via standard file system calls, or they can use
'libo2dlm' (distributed with ocfs2-tools) which abstracts the file
system calls and presents a more traditional locking api.
dlmfs handles lock caching automatically for the user, so a lock
request for an already acquired lock will not generate another DLM
call. Userspace programs are assumed to handle their own local
locking.
Two levels of locks are supported - Shared Read, and Exclusive.
Also supported is a Trylock operation.
For information on the libo2dlm interface, please see o2dlm.h,
distributed with ocfs2-tools.
Lock value blocks can be read and written to a resource via read(2)
and write(2) against the fd obtained via your open(2) call. The
maximum currently supported LVB length is 64 bytes (though that is an
OCFS2 DLM limitation). Through this mechanism, users of dlmfs can share
small amounts of data amongst their nodes.
Domain·resource inode와 open flag
87-123`mkdir(2)`는 생성되는 directory와 같은 이름의 domain에 가입하라는 신호이고, `rmdir(2)`는 그 domain에서 탈퇴하라는 신호입니다.
domain의 lock은 domain directory 안의 regular inode로 표현합니다. 해당 inode에 대한 `open(2)`이 lock request이며, trylock이 아니면 lock을 얻거나 error가 발생할 때까지 반환하지 않습니다. 성공하면 fd를 받습니다.
기존 lock resource가 있다고 해서 dlmfs가 inode를 자동으로 만들지는 않으므로, resource inode 생성을 보장하려면 `open(2)`에 `O_CREAT`를 사용합니다.
정확히 `O_RDONLY` 또는 `O_RDWR` 중 하나를 제공해야 합니다. `O_RDONLY`는 Shared Read, `O_RDWR`는 Exclusive request입니다. `O_NONBLOCK`을 함께 주면 Trylock이 됩니다.
유효한 Trylock이 resource lock을 얻지 못하면 `open(2)`은 `ETXTBUSY`를 반환합니다. `close(2)`는 fd와 연결된 lock을 해제합니다.
resource inode를 여는 flag가 lock mode와 대기 동작을 결정합니다.
mkdir(2) signals dlmfs to join a domain (which will have the same name
as the resulting directory)
rmdir(2) signals dlmfs to leave the domain
Locks for a given domain are represented by regular inodes inside the
domain directory. Locking against them is done via the open(2) system
call.
The open(2) call will not return until your lock has been granted or
an error has occurred, unless it has been instructed to do a trylock
operation. If the lock succeeds, you'll get an fd.
open(2) with O_CREAT to ensure the resource inode is created - dlmfs does
not automatically create inodes for existing lock resources.
============ ===========================
Open Flag Lock Request Type
============ ===========================
O_RDONLY Shared Read
O_RDWR Exclusive
============ ===========================
============ ===========================
Open Flag Resulting Locking Behavior
============ ===========================
O_NONBLOCK Trylock operation
============ ===========================
You must provide exactly one of O_RDONLY or O_RDWR.
If O_NONBLOCK is also provided and the trylock operation was valid but
could not lock the resource then open(2) will return ETXTBUSY.
close(2) drops the lock associated with your fd.
Local permission과 LVB visibility
124-140`mkdir(2)`나 `open(2)`에 전달한 mode는 local node에서 지켜지며 `chown`도 local에서 지원됩니다. 따라서 이 권한은 dlmfs resource에 대한 해당 node의 접근만 제한합니다.
resource LVB는 Shared Read 또는 Exclusive mode로 연 fd에서 `read(2)`할 수 있습니다. `write(2)`는 Exclusive mode에서만 허용됩니다.
한 번 기록한 LVB는 그 resource에서 Read Only 이상의 lock을 얻은 다른 node에도 보입니다. VMS distributed locking API에 관한 추가 자료는 원문의 OpenDLM PDF를 참고합니다.
node-local mode와 cluster-visible LVB의 범위를 구분합니다.
Modes passed to mkdir(2) or open(2) are adhered to locally. Chown is
supported locally as well. This means you can use them to restrict
access to the resources via dlmfs on your local node only.
The resource LVB may be read from the fd in either Shared Read or
Exclusive modes via the read(2) system call. It can be written via
write(2) only when open in Exclusive mode.
Once written, an LVB will be visible to other nodes who obtain Read
Only or higher level locks on the resource.
See Also
========
http://opendlm.sourceforge.net/cvsmirror/opendlm/docs/dlmbook_final.pdf
For more information on the VMS distributed locking API.
요약·해설
dlmfs.rst:1-140dlmfs는 OCFS2 DLM을 filesystem call로 노출합니다. directory는 lock domain, regular inode는 resource, `open` flag는 Shared Read·Exclusive·Trylock을 나타내며 fd의 read/write로 최대 64-byte LVB를 공유합니다.
filesystem object와 DLM 개념의 대응 관계입니다.