basic/mountpoint-util: skip dependency on quota services for some filesystems

This commit is contained in:
Thomas Blume 2022-09-29 14:50:48 +02:00 committed by Luca Boccassi
parent d2be5f641d
commit d72f4a3897
3 changed files with 28 additions and 3 deletions

View file

@ -393,6 +393,32 @@ bool fstype_is_network(const char *fstype) {
"sshfs");
}
bool fstype_needs_quota(const char *fstype) {
/* 1. quotacheck needs to be run for some filesystems after they are mounted
* if the filesystem was not unmounted cleanly.
* 2. You may need to run quotaon to enable quota usage tracking and/or
* enforcement.
* ext2 - needs 1) and 2)
* ext3 - needs 2) if configured using usrjquota/grpjquota mount options
* ext4 - needs 1) if created without journal, needs 2) if created without QUOTA
* filesystem feature
* reiserfs - needs 2).
* jfs - needs 2)
* f2fs - needs 2) if configured using usrjquota/grpjquota/prjjquota mount options
* xfs - nothing needed
* gfs2 - nothing needed
* ocfs2 - nothing needed
* btrfs - nothing needed
* for reference see filesystem and quota manpages */
return STR_IN_SET(fstype,
"ext2",
"ext3",
"ext4",
"reiserfs",
"jfs",
"f2fs");
}
bool fstype_is_api_vfs(const char *fstype) {
const FilesystemSet *fs;

View file

@ -13,6 +13,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags);
int path_is_mount_point(const char *path, const char *root, int flags);
bool fstype_is_network(const char *fstype);
bool fstype_needs_quota(const char *fstype);
bool fstype_is_api_vfs(const char *fstype);
bool fstype_is_blockdev_backed(const char *fstype);
bool fstype_is_ro(const char *fsype);

View file

@ -159,9 +159,7 @@ static bool mount_propagate_stop(Mount *m) {
static bool mount_needs_quota(const MountParameters *p) {
assert(p);
/* Quotas are not enabled on network filesystems, but we want them, for example, on storage connected via
* iscsi. We hence don't use mount_is_network() here, as that would also return true for _netdev devices. */
if (p->fstype && fstype_is_network(p->fstype))
if (p->fstype && !fstype_needs_quota(p->fstype))
return false;
if (mount_is_bind(p))