요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
===============
Quota subsystem
===============
Quota subsystem allows system administrator to set limits on used space and
number of used inodes (inode is a filesystem structure which is associated with
each file or directory) for users and/or groups. For both used space and number
of used inodes there are actually two limits. The first one is called softlimit
and the second one hardlimit. A user can never exceed a hardlimit for any
resource (unless he has CAP_SYS_RESOURCE capability). User is allowed to exceed
softlimit but only for limited period of time. This period is called "grace
period" or "grace time". When grace time is over, user is not able to allocate
more space/inodes until he frees enough of them to get below softlimit.
Quota limits (and amount of grace time) are set independently for each
filesystem.
For more details about quota design, see the documentation in quota-tools package
(https://sourceforge.net/projects/linuxquota).
Quota netlink interface
=======================
When user exceeds a softlimit, runs out of grace time or reaches hardlimit,
quota subsystem traditionally printed a message to the controlling terminal of
the process which caused the excess. This method has the disadvantage that
when user is using a graphical desktop he usually cannot see the message.
Thus quota netlink interface has been designed to pass information about
the above events to userspace. There they can be captured by an application
and processed accordingly.
The interface uses generic netlink framework (see
https://lwn.net/Articles/208755/ and http://www.infradead.org/~tgr/libnl/ for
more details about this layer). The name of the quota generic netlink interface
is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>. Since
the quota netlink protocol is not namespace aware, quota netlink messages are
sent only in initial network namespace.
Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
This command is used to send a notification about any of the above mentioned
events. Each message has six attributes. These are (type of the argument is
in parentheses):
QUOTA_NL_A_QTYPE (u32)
- type of quota being exceeded (one of USRQUOTA, GRPQUOTA)
QUOTA_NL_A_EXCESS_ID (u64)
- UID/GID (depends on quota type) of user / group whose limit
is being exceeded.
QUOTA_NL_A_CAUSED_ID (u64)
- UID of a user who caused the event
QUOTA_NL_A_WARNING (u32)
- what kind of limit is exceeded:
QUOTA_NL_IHARDWARN
inode hardlimit
QUOTA_NL_ISOFTLONGWARN
inode softlimit is exceeded longer
than given grace period
QUOTA_NL_ISOFTWARN
inode softlimit
QUOTA_NL_BHARDWARN
space (block) hardlimit
QUOTA_NL_BSOFTLONGWARN
space (block) softlimit is exceeded
longer than given grace period.
QUOTA_NL_BSOFTWARN
space (block) softlimit
- four warnings are also defined for the event when user stops
exceeding some limit:
QUOTA_NL_IHARDBELOW
inode hardlimit
QUOTA_NL_ISOFTBELOW
inode softlimit
QUOTA_NL_BHARDBELOW
space (block) hardlimit
QUOTA_NL_BSOFTBELOW
space (block) softlimit
QUOTA_NL_A_DEV_MAJOR (u32)
- major number of a device with the affected filesystem
QUOTA_NL_A_DEV_MINOR (u32)
- minor number of a device with the affected filesystem
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Quota 제한과 grace time
1-22Quota 서브시스템은 시스템 관리자가 사용자와 그룹별로 사용 공간과 사용 inode 수의 한도를 설정하게 한다. inode는 각 파일 또는 디렉터리에 연결된 파일시스템 구조다.
공간과 inode 수에는 각각 softlimit와 hardlimit가 있다. 사용자는 `CAP_SYS_RESOURCE` capability가 없는 한 어떤 자원의 hardlimit도 넘을 수 없다. softlimit는 일정 기간 넘을 수 있으며 이 기간을 grace period 또는 grace time이라고 한다.
Grace time이 끝나면 사용량을 softlimit 아래로 충분히 낮출 때까지 공간이나 inode를 더 할당할 수 없다. Quota 한도와 grace time은 파일시스템마다 독립적으로 설정한다.
더 자세한 quota 설계는 quota-tools 패키지 문서를 참고한다. 원문은 `https://sourceforge.net/projects/linuxquota`를 안내한다.
두 자원에 같은 soft·hard 제한 모델을 적용한다.
.. SPDX-License-Identifier: GPL-2.0
===============
Quota subsystem
===============
Quota subsystem allows system administrator to set limits on used space and
number of used inodes (inode is a filesystem structure which is associated with
each file or directory) for users and/or groups. For both used space and number
of used inodes there are actually two limits. The first one is called softlimit
and the second one hardlimit. A user can never exceed a hardlimit for any
resource (unless he has CAP_SYS_RESOURCE capability). User is allowed to exceed
softlimit but only for limited period of time. This period is called "grace
period" or "grace time". When grace time is over, user is not able to allocate
more space/inodes until he frees enough of them to get below softlimit.
Quota limits (and amount of grace time) are set independently for each
filesystem.
For more details about quota design, see the documentation in quota-tools package
(https://sourceforge.net/projects/linuxquota).
Generic netlink 경고 인터페이스
23-85전통적으로 quota 서브시스템은 사용자가 softlimit를 넘거나 grace time을 소진하거나 hardlimit에 도달하면, 초과를 일으킨 프로세스의 제어 터미널에 메시지를 출력했다. 그래픽 데스크톱에서는 사용자가 이 메시지를 보지 못하는 경우가 많아, 이벤트를 userspace 애플리케이션으로 전달하고 처리할 수 있도록 quota netlink 인터페이스를 설계했다.
이 인터페이스는 generic netlink 프레임워크를 사용하며 이름은 `VFS_DQUOT`이다. 아래 상수 정의는 `<linux/quota.h>`에 있다. Quota netlink 프로토콜은 namespace-aware가 아니므로 메시지는 initial network namespace에만 전송된다.
현재 지원하는 메시지 형식은 `QUOTA_NL_C_WARNING` 하나이며, softlimit 초과·grace time 만료·hardlimit 도달과 한도 아래로 복귀한 이벤트를 알린다. 각 메시지는 여섯 속성을 가진다.
경고 대상·원인 사용자·경고 종류·파일시스템 장치를 식별한다.
inode와 block 공간 각각에 hard, soft, grace 만료 상태가 있다.
사용량이 다시 제한 아래로 내려간 사건도 별도 코드로 알린다.
Quota netlink interface
=======================
When user exceeds a softlimit, runs out of grace time or reaches hardlimit,
quota subsystem traditionally printed a message to the controlling terminal of
the process which caused the excess. This method has the disadvantage that
when user is using a graphical desktop he usually cannot see the message.
Thus quota netlink interface has been designed to pass information about
the above events to userspace. There they can be captured by an application
and processed accordingly.
The interface uses generic netlink framework (see
https://lwn.net/Articles/208755/ and http://www.infradead.org/~tgr/libnl/ for
more details about this layer). The name of the quota generic netlink interface
is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>. Since
the quota netlink protocol is not namespace aware, quota netlink messages are
sent only in initial network namespace.
Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
This command is used to send a notification about any of the above mentioned
events. Each message has six attributes. These are (type of the argument is
in parentheses):
QUOTA_NL_A_QTYPE (u32)
- type of quota being exceeded (one of USRQUOTA, GRPQUOTA)
QUOTA_NL_A_EXCESS_ID (u64)
- UID/GID (depends on quota type) of user / group whose limit
is being exceeded.
QUOTA_NL_A_CAUSED_ID (u64)
- UID of a user who caused the event
QUOTA_NL_A_WARNING (u32)
- what kind of limit is exceeded:
QUOTA_NL_IHARDWARN
inode hardlimit
QUOTA_NL_ISOFTLONGWARN
inode softlimit is exceeded longer
than given grace period
QUOTA_NL_ISOFTWARN
inode softlimit
QUOTA_NL_BHARDWARN
space (block) hardlimit
QUOTA_NL_BSOFTLONGWARN
space (block) softlimit is exceeded
longer than given grace period.
QUOTA_NL_BSOFTWARN
space (block) softlimit
- four warnings are also defined for the event when user stops
exceeding some limit:
QUOTA_NL_IHARDBELOW
inode hardlimit
QUOTA_NL_ISOFTBELOW
inode softlimit
QUOTA_NL_BHARDBELOW
space (block) hardlimit
QUOTA_NL_BSOFTBELOW
space (block) softlimit
QUOTA_NL_A_DEV_MAJOR (u32)
- major number of a device with the affected filesystem
QUOTA_NL_A_DEV_MINOR (u32)
- minor number of a device with the affected filesystem
요약·해설
quota.rst:1-85Linux quota는 사용자·그룹별 공간 및 inode 사용량에 softlimit·hardlimit를 적용한다. Softlimit는 grace time 동안만 넘을 수 있고 hardlimit는 `CAP_SYS_RESOURCE` 예외를 제외하면 넘을 수 없다.
`VFS_DQUOT` generic netlink 인터페이스는 제한 초과와 복귀 이벤트를 userspace에 전달한다. 프로토콜이 namespace-aware가 아니므로 initial network namespace에서만 메시지를 받는다는 점이 배포와 모니터링에서 중요하다.
파일시스템 사용량 변화가 구조화된 netlink 경고로 변환된다.