From: Thomas Blume Date: Thu, 29 Sep 2022 12:50:48 +0000 (+0200) Subject: basic/mountpoint-util: skip dependency on quota services for some filesystems X-Git-Tag: v252-rc2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d72f4a38971e578523341993538265c388b9caaf;p=thirdparty%2Fsystemd.git basic/mountpoint-util: skip dependency on quota services for some filesystems --- diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index c7468e2a452..dc682688a7c 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -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; diff --git a/src/basic/mountpoint-util.h b/src/basic/mountpoint-util.h index aadb2123d91..e2b493aa20f 100644 --- a/src/basic/mountpoint-util.h +++ b/src/basic/mountpoint-util.h @@ -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); diff --git a/src/core/mount.c b/src/core/mount.c index d6bf009ada0..5e8a6ead619 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -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))