[PATCH] ext2: add store_sync in strategic places.
bug-hurd
Top
][
All Lists
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
[PATCH] ext2: add store_sync in strategic places.
From
Milos Nikic
Subject
[PATCH] ext2: add store_sync in strategic places.
Date
Tue, 27 Jan 2026 15:16:41 -0800
Now that we have a write barrier lets use it at some
critical points.
---
ext2fs/getblk.c | 9 ++++++++-
ext2fs/hyper.c | 8 +++++++-
ext2fs/inode.c | 7 ++++++-
ext2fs/pager.c | 9 ++++++++-
4 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c
index ed6e3e09..49ab5740 100644
--- a/ext2fs/getblk.c
+++ b/ext2fs/getblk.c
@@ -234,7 +234,14 @@ block_getblk (struct node *node, block_t block, int nr,
int create, int zero,
bh[nr] = *result;
if (diskfs_synchronous || diskfs_node_disknode (node)->info.i_osync)
- sync_global_ptr (bh, 1);
+ {
+ sync_global_ptr (bh, 1);
+ /* We just wrote a new indirect block pointer.
+ If this doesn't hit the platter, the file is corrupt. */
+ error_t err = store_sync (store);
+ if (err && err != EOPNOTSUPP)
+ ext2_warning ("indirect block flush failed: %s", strerror (err));
+ }
else
record_indir_poke (node, bh);
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
index 59458724..847f9f2b 100644
--- a/ext2fs/hyper.c
+++ b/ext2fs/hyper.c
@@ -220,7 +220,13 @@ diskfs_set_hypermetadata (int wait, int clean)
sync_global (wait);
+ if (wait)
+ {
+ error_t err = store_sync (store);
+ /* Ignore EOPNOTSUPP (legacy drivers), but warn on real I/O errors */
+ if (err && err != EOPNOTSUPP)
+ ext2_warning ("device flush failed: %s", strerror (err));
+ }
return 0;
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 8d1656f6..8d10af01 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -569,7 +569,12 @@ diskfs_write_disknode (struct node *np, int wait)
if (di)
if (wait)
- sync_global_ptr (di, 1);
+ {
+ sync_global_ptr (di, 1);
+ error_t err = store_sync (store);
+ if (err && err != EOPNOTSUPP)
+ ext2_warning ("inode flush failed: %s", strerror (err));
+ }
else
record_global_poke (di);
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index a7801bea..1c795784 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -1575,7 +1575,7 @@ diskfs_shutdown_pager (void)
/* Sync everything on the the disk pager. */
sync_global (1);
+ store_sync (store);
/* Despite the name of this function, we never actually shutdown the disk
pager, just make sure it's synced. */
@@ -1596,6 +1596,13 @@ diskfs_sync_everything (int wait)
/* Do things on the the disk pager. */
sync_global (wait);
+ if (wait)
+ {
+ error_t err = store_sync (store);
+ /* Ignore EOPNOTSUPP (drivers), but warn on real I/O errors */
+ if (err && err != EOPNOTSUPP)
+ ext2_warning ("device flush failed: %s", strerror (err));
+ }
static void
--
2.52.0
[Prev in Thread]
Current Thread
Next in Thread
[PATCH] ext2: add store_sync in strategic places.
Milos Nikic
<=
Re: [PATCH] ext2: add store_sync in strategic places.
Samuel Thibault
2026/01/27
Re: [PATCH] ext2: add store_sync in strategic places.
Milos Nikic
2026/01/28
Re: [PATCH] ext2: add store_sync in strategic places.
Samuel Thibault
2026/01/28
Re: [PATCH] ext2: add store_sync in strategic places.
Milos Nikic
2026/01/28
Re: [PATCH] ext2: add store_sync in strategic places.
Samuel Thibault
2026/01/28
Prev by Date:
Re: [PATCH v2 2/2 gnumach] CI: Add forgejo build/test script
Next by Date:
Re: [PATCH] ext2: add store_sync in strategic places.
Previous by thread:
[PATCH] rumpdisk: Defer hardware initialization to avoid deadlock on stat.
Next by thread:
Re: [PATCH] ext2: add store_sync in strategic places.
Index(es):
Date
Thread