]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/mountpoint-util: skip dependency on quota services for some filesystems
authorThomas Blume <tblume@suse.com>
Thu, 29 Sep 2022 12:50:48 +0000 (14:50 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 14 Oct 2022 18:57:30 +0000 (20:57 +0200)
src/basic/mountpoint-util.c
src/basic/mountpoint-util.h
src/core/mount.c

index c7468e2a4526901a2d11603be70f6dbcd94fabdc..dc682688a7c358be4c0c0b3d18c9b6922b722341 100644 (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;
 
index aadb2123d91680003cf9dd687c1628c1ddc16083..e2b493aa20f08ca91ea618a0546b58a3900c4e57 100644 (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);
index d6bf009ada0bfbf8030ef9d62ae9b6b8f80b5b58..5e8a6ead61995d5656de41376e6f7bed3ce67b57 100644 (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))