Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[udisks2] Reduce reserved blocks percentage to zero for ext2/ext3/ext…
…4 formatting. Fixes JB#43106
  • Loading branch information
rainemak committed Nov 21, 2018
1 parent e7b3763 commit 6ba3afe
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 49 deletions.
46 changes: 23 additions & 23 deletions rpm/0001-Disable-libblockdev-mdraid-and-part-support-from-sou.patch
@@ -1,7 +1,7 @@
From d80468db70396c4bf9046d3b6c0842376df98476 Mon Sep 17 00:00:00 2001
From 3b0df7a516a1523f96f43b906a470ad1de80c1a1 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Tue, 5 Dec 2017 11:17:50 +0200
Subject: [PATCH 1/8] Disable libblockdev-mdraid and part support from source
Subject: [PATCH 1/9] Disable libblockdev-mdraid and part support from source
tree

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
Expand All @@ -17,10 +17,10 @@ Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
8 files changed, 105 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5f1b0af4..61972a62 100644
index a20abea3..aea49bf7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -611,10 +611,6 @@ AC_TRY_COMPILE([#include <blockdev/mdraid.h>], [],
@@ -606,10 +606,6 @@ AC_TRY_COMPILE([#include <blockdev/mdraid.h>], [],
CFLAGS=$SAVE_CFLAGS
LDFLAGS=$SAVE_LDFLAGS

Expand Down Expand Up @@ -97,7 +97,7 @@ index 1f649d7c..eb404503 100644
error = NULL;

diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c
index 6a69bf3e..2a8ed305 100644
index fd82d0e4..e5bbc190 100644
--- a/src/udiskslinuxblock.c
+++ b/src/udiskslinuxblock.c
@@ -20,6 +20,10 @@
Expand All @@ -121,7 +121,7 @@ index 6a69bf3e..2a8ed305 100644
#include <blockdev/fs.h>

#include "udiskslogging.h"
@@ -2889,7 +2895,10 @@ udisks_linux_block_handle_format (UDisksBlock *block,
@@ -2911,7 +2917,10 @@ udisks_linux_block_handle_format (UDisksBlock *block,
GVariant *config_items = NULL;
gboolean teardown_flag = FALSE;
gboolean no_discard_flag = FALSE;
Expand All @@ -132,7 +132,7 @@ index 6a69bf3e..2a8ed305 100644

error = NULL;
object = udisks_daemon_util_dup_object (block, &error);
@@ -3263,11 +3272,13 @@ udisks_linux_block_handle_format (UDisksBlock *block,
@@ -3285,11 +3294,13 @@ udisks_linux_block_handle_format (UDisksBlock *block,
}
}

Expand All @@ -146,7 +146,7 @@ index 6a69bf3e..2a8ed305 100644
{
/* Build and run mkfs shell command */
const gchar *device = udisks_block_get_device (block_to_mkfs);
@@ -3295,6 +3306,8 @@ udisks_linux_block_handle_format (UDisksBlock *block,
@@ -3317,6 +3328,8 @@ udisks_linux_block_handle_format (UDisksBlock *block,
goto out;
}
}
Expand All @@ -155,7 +155,7 @@ index 6a69bf3e..2a8ed305 100644
else
{
/* Create the partition table. */
@@ -3304,6 +3317,7 @@ udisks_linux_block_handle_format (UDisksBlock *block,
@@ -3326,6 +3339,7 @@ udisks_linux_block_handle_format (UDisksBlock *block,
goto out;
}
}
Expand Down Expand Up @@ -314,7 +314,7 @@ index 51bdf708..0d8e96c1 100644

/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/udiskslinuxpartition.c b/src/udiskslinuxpartition.c
index 5fa20482..7260c00f 100644
index e490d21c..983d2bf3 100644
--- a/src/udiskslinuxpartition.c
+++ b/src/udiskslinuxpartition.c
@@ -18,6 +18,10 @@
Expand All @@ -338,15 +338,15 @@ index 5fa20482..7260c00f 100644

#include "udiskslogging.h"
#include "udiskslinuxpartition.h"
@@ -292,6 +298,7 @@ handle_set_flags (UDisksPartition *partition,
@@ -327,6 +333,7 @@ handle_set_flags (UDisksPartition *partition,
guint64 flags,
GVariant *options)
{
+#if BLOCKDEV_PART_ENABLED
UDisksBlock *block = NULL;
UDisksObject *object = NULL;
UDisksDaemon *daemon = NULL;
@@ -419,7 +426,7 @@ handle_set_flags (UDisksPartition *partition,
@@ -454,7 +461,7 @@ handle_set_flags (UDisksPartition *partition,
g_clear_object (&partition_table);
g_clear_object (&partition_table_block);
g_clear_object (&object);
Expand All @@ -355,15 +355,15 @@ index 5fa20482..7260c00f 100644
return TRUE; /* returning TRUE means that we handled the method invocation */
}

@@ -432,6 +439,7 @@ handle_set_name (UDisksPartition *partition,
@@ -467,6 +474,7 @@ handle_set_name (UDisksPartition *partition,
const gchar *name,
GVariant *options)
{
+#if BLOCKDEV_PART_ENABLED
UDisksBlock *block = NULL;
UDisksObject *object = NULL;
UDisksDaemon *daemon = NULL;
@@ -536,7 +544,7 @@ handle_set_name (UDisksPartition *partition,
@@ -571,7 +579,7 @@ handle_set_name (UDisksPartition *partition,
g_clear_object (&partition_table);
g_clear_object (&partition_table_block);
g_clear_object (&object);
Expand All @@ -372,15 +372,15 @@ index 5fa20482..7260c00f 100644
return TRUE; /* returning TRUE means that we handled the method invocation */
}

@@ -593,6 +601,7 @@ udisks_linux_partition_set_type_sync (UDisksLinuxPartition *partition,
@@ -628,6 +636,7 @@ udisks_linux_partition_set_type_sync (UDisksLinuxPartition *partition,
GCancellable *cancellable,
GError **error)
{
+#if BLOCKDEV_PART_ENABLED
gboolean ret = FALSE;
UDisksBlock *block = NULL;
UDisksObject *object = NULL;
@@ -724,8 +733,10 @@ udisks_linux_partition_set_type_sync (UDisksLinuxPartition *partition,
@@ -759,8 +768,10 @@ udisks_linux_partition_set_type_sync (UDisksLinuxPartition *partition,
g_clear_object (&partition_table_block);
g_clear_object (&object);
g_clear_error (&loc_error);
Expand All @@ -392,31 +392,31 @@ index 5fa20482..7260c00f 100644
}

/* ---------------------------------------------------------------------------------------------------- */
@@ -763,6 +774,7 @@ typedef struct
@@ -798,6 +809,7 @@ typedef struct
guint64 new_size;
} WaitForPartitionResizeData;

+#if BLOCKDEV_PART_ENABLED
static UDisksObject *
wait_for_partition_resize (UDisksDaemon *daemon,
gpointer user_data)
@@ -785,6 +797,7 @@ wait_for_partition_resize (UDisksDaemon *daemon,
@@ -820,6 +832,7 @@ wait_for_partition_resize (UDisksDaemon *daemon,

return object;
}
+#endif

/* runs in thread dedicated to handling @invocation */
static gboolean
@@ -793,6 +806,7 @@ handle_resize (UDisksPartition *partition,
@@ -828,6 +841,7 @@ handle_resize (UDisksPartition *partition,
guint64 size,
GVariant *options)
{
+#if BLOCKDEV_PART_ENABLED
UDisksBlock *block = NULL;
UDisksObject *object = NULL;
UDisksDaemon *daemon = NULL;
@@ -891,7 +905,9 @@ handle_resize (UDisksPartition *partition,
@@ -926,7 +940,9 @@ handle_resize (UDisksPartition *partition,
g_clear_object (&partition_table_block);

return TRUE; /* returning TRUE means that we handled the method invocation */
Expand All @@ -427,15 +427,15 @@ index 5fa20482..7260c00f 100644
}

/* ---------------------------------------------------------------------------------------------------- */
@@ -902,6 +918,7 @@ handle_delete (UDisksPartition *partition,
@@ -937,6 +953,7 @@ handle_delete (UDisksPartition *partition,
GDBusMethodInvocation *invocation,
GVariant *options)
{
+#if BLOCKDEV_PART_ENABLED
UDisksBlock *block = NULL;
UDisksObject *object = NULL;
UDisksDaemon *daemon = NULL;
@@ -989,6 +1006,9 @@ handle_delete (UDisksPartition *partition,
@@ -1024,6 +1041,9 @@ handle_delete (UDisksPartition *partition,
g_clear_object (&object);

return TRUE; /* returning TRUE means that we handled the method invocation */
Expand Down Expand Up @@ -489,5 +489,5 @@ index a52d4084..9cdc2368 100644

static int
--
2.17.1
2.17.2

10 changes: 5 additions & 5 deletions rpm/0002-Drop-smartata-dependencies.patch
@@ -1,7 +1,7 @@
From fce6c2b7904eec9fbb4be5151178bc923d509ed3 Mon Sep 17 00:00:00 2001
From 1eefa406578f85320a7b2e0b488c914814155c34 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Thu, 7 Dec 2017 13:15:34 +0200
Subject: [PATCH 2/8] Drop smartata dependencies
Subject: [PATCH 2/9] Drop smartata dependencies

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
Expand All @@ -10,10 +10,10 @@ Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 61972a62..8bdb5a9f 100644
index aea49bf7..6a482e4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,10 +166,6 @@ PKG_CHECK_MODULES(POLKIT_AGENT_1, [polkit-agent-1 >= 0.102])
@@ -161,10 +161,6 @@ PKG_CHECK_MODULES(POLKIT_AGENT_1, [polkit-agent-1 >= 0.102])
AC_SUBST(POLKIT_AGENT_1_CFLAGS)
AC_SUBST(POLKIT_AGENT_1_LIBS)

Expand Down Expand Up @@ -118,5 +118,5 @@ index da349cd8..978b57a2 100644

/* ---------------------------------------------------------------------------------------------------- */
--
2.17.1
2.17.2

@@ -1,7 +1,7 @@
From 43e2067c1e2df252e44b795a06773992c42be82d Mon Sep 17 00:00:00 2001
From 71a5b663652054e81e7f6e671f257e349a0fcf4e Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Tue, 6 Feb 2018 14:01:16 +0200
Subject: [PATCH 3/8] Loosen up polkit policies to work from another seat
Subject: [PATCH 3/9] Loosen up polkit policies to work from another seat

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
Expand Down Expand Up @@ -112,5 +112,5 @@ index d97528d4..eaf13908 100644
</action>

--
2.17.1
2.17.2

@@ -1,7 +1,7 @@
From 238885252bcc61b33b04e7b2f35386cd1654216e Mon Sep 17 00:00:00 2001
From 171d5879207b5e72c14a2b06a33dea157de01882 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Tue, 6 Feb 2018 14:08:59 +0200
Subject: [PATCH 4/8] Introduce mount-sd service that is executed as nemo
Subject: [PATCH 4/9] Introduce mount-sd service that is executed as nemo

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
Expand All @@ -12,7 +12,7 @@ Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
create mode 100644 data/mount-sd@.service

diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules
index e8f7c5ee..6e042977 100644
index a64f1cb3..e3eb74e5 100644
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -41,6 +41,9 @@ ENV{ID_VENDOR}=="*IOMEGA*", ENV{ID_MODEL}=="*ZIP*", ENV{ID_DRIVE_FLOPPY_ZIP}="1"
Expand Down Expand Up @@ -57,5 +57,5 @@ index 00000000..c44deebd
+ExecStart=/usr/bin/udisksctl mount -b /dev/%i
+ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
--
2.17.1
2.17.2

4 changes: 2 additions & 2 deletions rpm/0005-Add-udev-rule-for-the-sda-drives.patch
@@ -1,7 +1,7 @@
From 840148a2cc7d47cb4f14ff0bbd8203936fb41a94 Mon Sep 17 00:00:00 2001
From 25ad885b47243abcfd5d796d8a68f29c9431c67b Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Mon, 12 Mar 2018 10:18:03 +0200
Subject: [PATCH 5/8] Add udev rule for the sda drives
Subject: [PATCH 5/9] Add udev rule for the sda drives

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
Expand Down
8 changes: 4 additions & 4 deletions rpm/0006-Disable-zram-rule-for-now.patch
@@ -1,15 +1,15 @@
From a47bdb65dce36e359fd160a6b2612f650464d501 Mon Sep 17 00:00:00 2001
From 40af3ef886ae4d069ded42d282033dbc4fd6fae8 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Wed, 11 Apr 2018 11:11:53 +0300
Subject: [PATCH 6/8] Disable zram rule for now
Subject: [PATCH 6/9] Disable zram rule for now

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
data/80-udisks2.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules
index 0bb0fe47..559ca268 100644
index 88b3d3b9..ab0c0266 100644
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -174,7 +174,7 @@ KERNEL=="sr*", ENV{ID_VENDOR}=="Linux", ENV{ID_MODEL}=="File-CD_Gadget*", ENV{ID
Expand All @@ -22,5 +22,5 @@ index 0bb0fe47..559ca268 100644
# Explicitly ignore ram block devices, they don't work with udev
KERNEL=="ram*", ENV{UDISKS_IGNORE}="1"
--
2.17.1
2.17.2

6 changes: 3 additions & 3 deletions rpm/0007-Create-mount-path-with-755-rights.patch
@@ -1,7 +1,7 @@
From 25d40682c8393178112ca1f3e8630f90184ce84a Mon Sep 17 00:00:00 2001
From ec9e62b03aab73427a6b290fd5140134f4526ac8 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Wed, 18 Apr 2018 18:00:00 +0300
Subject: [PATCH 7/8] Create mount path with 755 rights
Subject: [PATCH 7/9] Create mount path with 755 rights

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
Expand All @@ -22,5 +22,5 @@ index 8d1bff42..97f1d1a4 100644
if (g_mkdir (mount_dir, 0750) != 0 && errno != EEXIST)
#endif
--
2.17.1
2.17.2

@@ -1,7 +1,7 @@
From 6f14b8f50eb50a20e8cd20e8fc07f7e3a03fd0b4 Mon Sep 17 00:00:00 2001
From faf545a45093c492fbc9cc40b18e63675bcf1e89 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Tue, 18 Sep 2018 17:04:36 +0300
Subject: [PATCH 8/8] Make it possible to encrypt mmcblk* (format with
Subject: [PATCH 8/9] Make it possible to encrypt mmcblk* (format with
encryption)

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
Expand All @@ -10,10 +10,10 @@ Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
1 file changed, 5 insertions(+)

diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c
index 2a8ed305..87aa924f 100644
index e5bbc190..9eecd59c 100644
--- a/src/udiskslinuxblock.c
+++ b/src/udiskslinuxblock.c
@@ -2257,8 +2257,13 @@ wait_for_luks_uuid (UDisksDaemon *daemon,
@@ -2279,8 +2279,13 @@ wait_for_luks_uuid (UDisksDaemon *daemon,
if (block == NULL)
goto out;

Expand All @@ -28,5 +28,5 @@ index 2a8ed305..87aa924f 100644
ret = g_object_ref (data->object);

--
2.17.1
2.17.2

@@ -0,0 +1,45 @@
From e63cbc17f8afcc2f99c45150bbd366a8dccc5199 Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Wed, 21 Nov 2018 17:27:59 +0200
Subject: [PATCH 9/9] Reduce reserved blocks percentage to zero for
ext2/ext3/ext4 formatting

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
src/udiskslinuxfsinfo.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/udiskslinuxfsinfo.c b/src/udiskslinuxfsinfo.c
index d9e9f814..ba0049cd 100644
--- a/src/udiskslinuxfsinfo.c
+++ b/src/udiskslinuxfsinfo.c
@@ -70,7 +70,7 @@ const FSInfo _fs_info[] =
NULL,
TRUE, /* supports_online_label_rename */
TRUE, /* supports_owners */
- "mkfs.ext2 -F -L $LABEL $OPTIONS $DEVICE",
+ "mkfs.ext2 -m 0 -F -L $LABEL $OPTIONS $DEVICE",
"mkfs.ext2 -n -F -L $LABEL $OPTIONS $DEVICE",
"-E nodiscard", /* option_no_discard */
},
@@ -80,7 +80,7 @@ const FSInfo _fs_info[] =
NULL,
TRUE, /* supports_online_label_rename */
TRUE, /* supports_owners */
- "mkfs.ext3 -F -L $LABEL $OPTIONS $DEVICE",
+ "mkfs.ext3 -m 0 -F -L $LABEL $OPTIONS $DEVICE",
"mkfs.ext3 -n -F -L $LABEL $OPTIONS $DEVICE",
"-E nodiscard", /* option_no_discard */
},
@@ -90,7 +90,7 @@ const FSInfo _fs_info[] =
NULL,
TRUE, /* supports_online_label_rename */
TRUE, /* supports_owners */
- "mkfs.ext4 -F -L $LABEL $OPTIONS $DEVICE",
+ "mkfs.ext4 -m 0 -F -L $LABEL $OPTIONS $DEVICE",
"mkfs.ext4 -n -F -L $LABEL $OPTIONS $DEVICE",
"-E nodiscard", /* option_no_discard */
},
--
2.17.2

0 comments on commit 6ba3afe

Please sign in to comment.