* [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs
@ 2026-11-27 4:40 Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 1/8] nilfs2: fix leak of gc inodes on error Ryusuke Konishi
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
Hi Viacheslav,
Please apply this series for the next cycle.
This patch series rectifies an early design flaw in the garbage
collection mechanism itself and fundamentally resolves the task hang
issue seen in the GC ioctl (NILFS_IOCTL_CLEAN_SEGMENTS). To make GC
safely abortable upon errors, this series strengthens the error-recovery
and rollback logic for metadata updated during GC, specifically segment
usage information (sufile) and virtual block address mappings (DAT).
Historically, NILFS2 GC was designed around a point of no return: once
the log writer started, it looped until a full-format log (including a
checkpoint and a super root) was successfully written out. Because GC
runs exclusively while holding ns_segctor_sem for writing, any
persistent error during GC blocked the log writer thread and write
operations indefinitely, causing filesystem hangs.
An initial fix by Joshua Crofts (commit ce5a5ad1a833) took the right
direction by introducing an escape path when the filesystem
transitioned to read-only mode (-EROFS). However, two issues remained:
1. Cached GC inodes were leaked when GC exited on error, which Wang
Jianjian addressed in the first patch of this series.
2. Persistent errors that do not trigger read-only remounts (such as
-EIO or -ENOSPC) still caused infinite retry loops, as further
reported by Zheng Zheng.
Whenever GC aborts mid-way, however, an underlying issue arises:
bailing out of the GC loop leaves irreversible inconsistencies in
on-disk and in-memory metadata. While this was previously masked
because the escape path was only taken during emergency read-only
degradation, expanding error exits to general errors exposes this
problem, breaking subsequent GC runs and causing userland tools such
as "lssu -l" to fail permanently.
To build upon commit ce5a5ad1a833 and make error exits safe, this
series implements dedicated undo mechanisms for each metadata change
performed during GC before allowing nilfs_clean_segments() to bail
out on general errors:
- Patch 1 (by Wang Jianjian) fixes the GC inode leak on error paths.
- Patch 2 makes physical block location updates in the DAT for
GC-relocated blocks (other than DAT blocks themselves) reversible by
restoring them from the shadow mapping on error.
- Patch 3 makes the removal of GC target segment usage entries in
sufile reversible by saving and restoring them on abort.
- Patch 4 fixes an issue where stale nilfs_redirected flags remain on
primary DAT buffers when GC is aborted.
- Patches 5-6 make the deletion of obsolete virtual block entries from
the DAT during GC reversible by saving and restoring them on abort.
- Patch 7 defers this virtual block deletion to a safe stage so that the
freed entries cannot be reallocated while GC is in progress, which is
required now that GC can abort mid-way.
- Patch 8 updates nilfs_clean_segments() to bail out immediately on
errors, retaining only a minimal bounded retry loop for transient
cases.
Thanks,
Ryusuke Konishi
Ryusuke Konishi (7):
nilfs2: cancel the relocation of GC-targeted blocks if log writing
fails
nilfs2: restore segment usage from the save buffer when aborting GC
nilfs2: drop redirected buffer flag from DAT when clearing shadow map
nilfs2: save DAT entry blocks to shadow mapping before freeing
nilfs2: restore removed DAT entries when aborting GC
nilfs2: free virtual block numbers just before collecting DAT changes
nilfs2: avoid infinite retry loop on GC failure
Wang Jianjian (1):
nilfs2: fix leak of gc inodes on error
fs/nilfs2/alloc.c | 14 +++-
fs/nilfs2/alloc.h | 3 +-
fs/nilfs2/bmap.h | 23 ++++++
fs/nilfs2/btree.c | 8 ++
fs/nilfs2/dat.c | 181 +++++++++++++++++++++++++++++++++++++++++++-
fs/nilfs2/dat.h | 5 +-
fs/nilfs2/direct.c | 1 +
fs/nilfs2/ioctl.c | 36 +--------
fs/nilfs2/mdt.c | 41 ++++++++--
fs/nilfs2/segment.c | 108 +++++++++++++++++++++++---
fs/nilfs2/segment.h | 7 ++
fs/nilfs2/sufile.c | 27 ++++---
fs/nilfs2/sufile.h | 37 ++++-----
13 files changed, 404 insertions(+), 87 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] nilfs2: fix leak of gc inodes on error
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 2/8] nilfs2: cancel the relocation of GC-targeted blocks if log writing fails Ryusuke Konishi
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
From: Wang Jianjian <wangjianjian3@huawei.com>
Zhengzheng reported below syz problems:
NILFS (loop5): disposed unprocessed dirty file(s) when stopping log writer
VFS: Busy inodes after unmount of loop5 (nilfs2)
The reproducer called ioctl clean_segments on a corrupted image. It's
first argument is { ino = 8, cno = 0xffffffffffffffff, vd_vblocknr = 34,
vd_period = [0x30000000000000, 0x10), vd_blocknr = 6, vd_offset =
7,...}.
nilfs_ioctl_clean_segments
nilfs_ioctl_move_blocks // gc iget 8, get one inode reference
nilfs_clean_segments
nilfs->ns_gc_inodes move to sci->sc_gc_inodes
nilfs_segctor_construct
nilfs_segctor_do_construct
nilfs_segctor_assign
nilfs_segctor_update_payload_blocknr
nilfs_bmap_assign
nilfs_btree_assign_gc
nilfs_dat_move
// since there is no dat entry for vblknr 34
// (entry->de_blocknr == 0), return -EINVAL
// fs will be remounted to readonly
// clean segments loop will be break because readonly fs
nilfs_remove_all_gcinodes
// since nilfs->ns_gc_inodes empty, it
// clean nothing
ioctl_clean_segment will get one extra reference of inode 8 and when
segments construct do GC move vblock 34 and do bmap assign, it lookup
DAT table and get de_blocknr = 0, so it return -EINVAL. And since
nilfs->ns_gc_inodes is empty, nilfs_remove_all_gcinodes will do nothing
and the extra inode reference won't be released.
To fix this, splice sci->sc_gc_inodes back to nilfs->ns_gc_inodes when
got error.
Note that, when normal files add to nilfs dirty list by
nilfs_set_file_dirty, it will got one reference and when
nilfs_bmap_assign got error, nilfs_segctor_do_construct() also doesn't
put the inode, but as a last resort, nilfs_segctor_destroy will do
it(however, it doesn't clean sci->sc_gc_inodes).
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
Reported-by: fengaojigui88@gmail.com
Closes: https://lore.kernel.org/linux-nilfs/CAO-4RZ2=4okHYZ-xCkpV-ekj-aSqKLnYGOsRM9A2dD8R4Ozzeg@mail.gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/segment.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 68b640a7aa5b..4c2d51f6550c 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2586,6 +2586,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
out_unlock:
sci->sc_freesegs = NULL;
sci->sc_nfreesegs = 0;
+ list_splice_tail_init(&sci->sc_gc_inodes, &nilfs->ns_gc_inodes);
nilfs_mdt_clear_shadow_map(nilfs->ns_dat);
bail_unlock:
nilfs_transaction_unlock(sb);
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/8] nilfs2: cancel the relocation of GC-targeted blocks if log writing fails
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 1/8] nilfs2: fix leak of gc inodes on error Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 3/8] nilfs2: restore segment usage from the save buffer when aborting GC Ryusuke Konishi
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
Since commit ce5a5ad1a833 ("nilfs2: fix infinite loop in
nilfs_clean_segments()"), an escape path was added to exit the GC loop
in nilfs_clean_segments() when GC fails.
When log writing fails, dirty metadata and data buffers for regular
inodes remain dirty in memory, so retrying the log write causes no
inconsistency. However, for blocks relocated by garbage collection,
their physical block mappings in the DAT have already been updated to
the new locations during log writing. If GC aborts on error and
discards its cached GC inodes without reverting these DAT mappings,
subsequent data reads or B-tree lookups will end up reading unwritten
block locations.
To allow safely bailing out of the GC loop on error, add a mechanism to
cancel the relocation of GC-targeted blocks and partially restore the
DAT when log writing fails in a GC context. Specifically, introduce
nilfs_dat_undo_move() to restore original physical block numbers from
the saved buffers in the DAT shadow mapping, expose it through a new
bmap operation bop_undo_assign and nilfs_bmap_undo_assign() (set only
for GC inodes), and invoke nilfs_cancel_block_relocation() from
nilfs_segctor_abort_construction() when nilfs_doing_gc() is true.
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/bmap.h | 23 ++++++++++++++++++
fs/nilfs2/btree.c | 8 +++++++
fs/nilfs2/dat.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
fs/nilfs2/dat.h | 1 +
fs/nilfs2/direct.c | 1 +
fs/nilfs2/segment.c | 35 +++++++++++++++++++++++++++
6 files changed, 126 insertions(+)
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h
index a72f3c308a5d..6493217b1a7f 100644
--- a/fs/nilfs2/bmap.h
+++ b/fs/nilfs2/bmap.h
@@ -53,6 +53,7 @@ struct nilfs_bmap_stats {
* mapping root
* @bop_lookup_dirty_buffers: operation to collect dirty block buffers
* @bop_assign: disk block address assignment operation
+ * @bop_undo_assign: undo disk block address assignment operation
* @bop_mark: operation to mark in-use blocks as dirty for
* relocation by GC
* @bop_seek_key: find valid block key operation
@@ -74,6 +75,8 @@ struct nilfs_bmap_operations {
struct buffer_head **,
sector_t,
union nilfs_binfo *);
+ void (*bop_undo_assign)(struct nilfs_bmap *bmap,
+ struct buffer_head *bh);
int (*bop_mark)(struct nilfs_bmap *, __u64, int);
int (*bop_seek_key)(const struct nilfs_bmap *, __u64, __u64 *);
@@ -182,6 +185,26 @@ static inline int nilfs_bmap_lookup(struct nilfs_bmap *bmap, __u64 key,
return nilfs_bmap_lookup_at_level(bmap, key, 1, ptr);
}
+/**
+ * nilfs_bmap_undo_assign - restore the block number to its original position
+ * @bmap: bmap
+ * @bh: buffer head for which the block number should be undone
+ *
+ * nilfs_bmap_undo_assign() undoes the block relocation performed during
+ * garbage collection for the buffer @bh and restores its original block
+ * position. For regular bmaps where bop_undo_assign is %NULL, this
+ * function is a no-op.
+ */
+static inline void nilfs_bmap_undo_assign(struct nilfs_bmap *bmap,
+ struct buffer_head *bh)
+{
+ if (bmap->b_ops->bop_undo_assign) {
+ down_write(&bmap->b_sem);
+ bmap->b_ops->bop_undo_assign(bmap, bh);
+ up_write(&bmap->b_sem);
+ }
+}
+
/*
* Internal use only
*/
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 6b8332e8c0db..8c12b78c0e9d 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -2378,6 +2378,12 @@ static int nilfs_btree_assign_gc(struct nilfs_bmap *btree,
return 0;
}
+static void nilfs_btree_undo_assign_gc(struct nilfs_bmap *btree,
+ struct buffer_head *bh)
+{
+ nilfs_dat_undo_move(nilfs_bmap_get_dat(btree), bh->b_blocknr);
+}
+
static int nilfs_btree_mark(struct nilfs_bmap *btree, __u64 key, int level)
{
struct buffer_head *bh;
@@ -2423,6 +2429,7 @@ static const struct nilfs_bmap_operations nilfs_btree_ops = {
.bop_lookup_dirty_buffers = nilfs_btree_lookup_dirty_buffers,
.bop_assign = nilfs_btree_assign,
+ .bop_undo_assign = NULL,
.bop_mark = nilfs_btree_mark,
.bop_seek_key = nilfs_btree_seek_key,
@@ -2445,6 +2452,7 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = {
.bop_lookup_dirty_buffers = nilfs_btree_lookup_dirty_buffers,
.bop_assign = nilfs_btree_assign_gc,
+ .bop_undo_assign = nilfs_btree_undo_assign_gc,
.bop_mark = NULL,
.bop_seek_key = NULL,
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index 888dc1831c86..d2718944368b 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -379,6 +379,64 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
return 0;
}
+/**
+ * nilfs_dat_undo_move - undo the change to the block number
+ * @dat: DAT file inode
+ * @vblocknr: virtual block number
+ *
+ * nilfs_dat_undo_move() restores the original physical block number for
+ * @vblocknr from the frozen DAT entry buffer in the shadow mapping, if such
+ * a saved buffer exists and is marked uptodate; otherwise, it does nothing.
+ */
+void nilfs_dat_undo_move(struct inode *dat, __u64 vblocknr)
+{
+ struct buffer_head *entry_bh, *saved_bh;
+ int ret;
+
+ if (WARN_ON_ONCE(!nilfs_doing_gc()))
+ return;
+
+ ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh);
+ if (ret < 0) {
+ if (unlikely(ret != -ENOENT)) {
+ nilfs_warn(dat->i_sb,
+ "%s: error %d loading the entry block for vblocknr = %llu",
+ __func__, ret, (unsigned long long)vblocknr);
+ }
+ return;
+ }
+
+ if (!buffer_nilfs_redirected(entry_bh))
+ goto release_entry_bh;
+
+ saved_bh = nilfs_mdt_get_frozen_buffer(dat, entry_bh);
+ if (!saved_bh)
+ goto release_entry_bh;
+
+ if (likely(buffer_uptodate(saved_bh))) {
+ struct nilfs_dat_entry *entry, *saved_entry;
+ __le64 cur_blocknr, orig_blocknr;
+ size_t offset;
+
+ offset = nilfs_palloc_entry_offset(dat, vblocknr, entry_bh);
+ entry = kmap_local_folio(entry_bh->b_folio, offset);
+ saved_entry = kmap_local_folio(saved_bh->b_folio, offset);
+ cur_blocknr = entry->de_blocknr;
+ entry->de_blocknr = orig_blocknr = saved_entry->de_blocknr;
+ kunmap_local(saved_entry);
+ kunmap_local(entry);
+ if (cur_blocknr != orig_blocknr) {
+ mark_buffer_dirty(entry_bh);
+ nilfs_mdt_mark_dirty(dat);
+ }
+ }
+
+ brelse(saved_bh);
+
+release_entry_bh:
+ brelse(entry_bh);
+}
+
/**
* nilfs_dat_translate - translate a virtual block number to a block number
* @dat: DAT file inode
diff --git a/fs/nilfs2/dat.h b/fs/nilfs2/dat.h
index 468c82d26183..4f67f31f928b 100644
--- a/fs/nilfs2/dat.h
+++ b/fs/nilfs2/dat.h
@@ -39,6 +39,7 @@ void nilfs_dat_abort_update(struct inode *, struct nilfs_palloc_req *,
int nilfs_dat_mark_dirty(struct inode *, __u64);
int nilfs_dat_freev(struct inode *, __u64 *, size_t);
int nilfs_dat_move(struct inode *, __u64, sector_t);
+void nilfs_dat_undo_move(struct inode *dat, __u64 vblocknr);
ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned int, size_t);
int nilfs_dat_read(struct super_block *sb, size_t entry_size,
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c
index 64da677dc8d4..18a700db76ed 100644
--- a/fs/nilfs2/direct.c
+++ b/fs/nilfs2/direct.c
@@ -375,6 +375,7 @@ static const struct nilfs_bmap_operations nilfs_direct_ops = {
.bop_lookup_dirty_buffers = NULL,
.bop_assign = nilfs_direct_assign,
+ .bop_undo_assign = NULL,
.bop_mark = NULL,
.bop_seek_key = nilfs_direct_seek_key,
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 4c2d51f6550c..24f8fa8cf864 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1860,6 +1860,39 @@ static void nilfs_abort_logs(struct list_head *logs, int err)
nilfs_end_folio_io(fs_folio, err);
}
+/**
+ * nilfs_cancel_block_relocation - cancel relocation of GC-targeted blocks
+ * @logs: list of segment buffers whose log write failed or was aborted
+ *
+ * nilfs_cancel_block_relocation() iterates through the payload buffers of
+ * each segment buffer in @logs (excluding the super root block) and calls
+ * nilfs_bmap_undo_assign() to revert the DAT mappings of blocks relocated
+ * by garbage collection. This is necessary to prevent subsequent data reads
+ * or B-tree lookups from accessing unwritten block locations via the DAT
+ * after GC aborts on error and discards the cached GC inodes.
+ */
+static void nilfs_cancel_block_relocation(struct list_head *logs)
+{
+ struct nilfs_segment_buffer *segbuf;
+ struct buffer_head *bh;
+ struct inode *inode;
+
+ list_for_each_entry(segbuf, logs, sb_list) {
+ list_for_each_entry(bh, &segbuf->sb_payload_buffers,
+ b_assoc_buffers) {
+ if (bh == segbuf->sb_super_root)
+ break;
+ inode = bh->b_folio->mapping->host;
+ /*
+ * NILFS_I(inode)->i_bmap points to the primary inode's
+ * bmap structure, whether the inode serves as a cache
+ * for B-tree nodes or as the primary inode itself.
+ */
+ nilfs_bmap_undo_assign(NILFS_I(inode)->i_bmap, bh);
+ }
+ }
+}
+
static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
struct the_nilfs *nilfs, int err)
{
@@ -1874,6 +1907,8 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
if (list_empty(&logs))
return; /* if the first segment buffer preparation failed */
+ if (nilfs_doing_gc())
+ nilfs_cancel_block_relocation(&logs);
nilfs_cancel_segusage(&logs, nilfs->ns_sufile);
nilfs_free_incomplete_logs(&logs, nilfs);
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/8] nilfs2: restore segment usage from the save buffer when aborting GC
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 1/8] nilfs2: fix leak of gc inodes on error Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 2/8] nilfs2: cancel the relocation of GC-targeted blocks if log writing fails Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 4/8] nilfs2: drop redirected buffer flag from DAT when clearing shadow map Ryusuke Konishi
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
Since commit ce5a5ad1a833 ("nilfs2: fix infinite loop in
nilfs_clean_segments()"), an escape path was added to exit the GC loop
in nilfs_clean_segments() when GC fails. However, if log writing is
aborted during GC, the segment usage entries of the target segments that
were temporarily freed for GC are left in a corrupted state, losing
metadata such as timestamps and block counts.
This happens because nilfs_sufile_cancel_freev(), which is called to
cancel the segment release performed by nilfs_sufile_freev(), only marks
the segment usage as dirty again without restoring its original
metadata.
To allow GC to safely abort on error after starting, the pair of
nilfs_sufile_freev() and nilfs_sufile_cancel_freev() must be able to
fully restore the segment usage entries.
Fix this by passing a save buffer for segment usage entries to the
batch update functions of the segment usage metadata file (sufile) so
that the original entries are saved on release and properly restored on
failure. The save buffer is allocated and freed in
nilfs_clean_segments().
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/segment.c | 30 ++++++++++++++++++++++++------
fs/nilfs2/segment.h | 2 ++
fs/nilfs2/sufile.c | 27 +++++++++++++++++----------
fs/nilfs2/sufile.h | 37 ++++++++++++++++++++-----------------
4 files changed, 63 insertions(+), 33 deletions(-)
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 24f8fa8cf864..263f9ff00193 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1109,6 +1109,7 @@ static int nilfs_segctor_scan_file_dsync(struct nilfs_sc_info *sci,
* @nilfs: nilfs object
* @segnumv: array of segment numbers to be freed
* @nsegs: number of segments to be freed in @segnumv
+ * @subuf: buffer for saving and restoring segment usage entries
*
* nilfs_free_segments() wraps nilfs_sufile_freev() and
* nilfs_sufile_cancel_freev(), and edits the segment usage metadata file
@@ -1127,7 +1128,7 @@ static int nilfs_segctor_scan_file_dsync(struct nilfs_sc_info *sci,
* * %-ENOMEM - Insufficient memory available.
*/
static int nilfs_free_segments(struct the_nilfs *nilfs, __u64 *segnumv,
- size_t nsegs)
+ size_t nsegs, void *subuf)
{
size_t ndone;
int ret;
@@ -1135,10 +1136,11 @@ static int nilfs_free_segments(struct the_nilfs *nilfs, __u64 *segnumv,
if (!nsegs)
return 0;
- ret = nilfs_sufile_freev(nilfs->ns_sufile, segnumv, nsegs, &ndone);
+ ret = nilfs_sufile_freev(nilfs->ns_sufile, segnumv, nsegs, &ndone,
+ subuf);
if (unlikely(ret)) {
nilfs_sufile_cancel_freev(nilfs->ns_sufile, segnumv, ndone,
- NULL);
+ NULL, subuf);
/*
* If a segment usage of the segments to be freed is in a
* hole block, nilfs_sufile_freev() will return -ENOENT.
@@ -1257,7 +1259,7 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
fallthrough;
case NILFS_ST_SUFILE:
err = nilfs_free_segments(nilfs, sci->sc_freesegs,
- sci->sc_nfreesegs);
+ sci->sc_nfreesegs, sci->sc_subuf);
if (unlikely(err))
break;
sci->sc_stage.flags |= NILFS_CF_SUFREED;
@@ -1565,7 +1567,7 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
err = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
sci->sc_freesegs,
sci->sc_nfreesegs,
- NULL);
+ NULL, sci->sc_subuf);
nilfs_sufile_warn_on_error(nilfs->ns_sufile, err);
sci->sc_stage.flags &= ~NILFS_CF_SUFREED;
}
@@ -1916,7 +1918,7 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
ret = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
sci->sc_freesegs,
sci->sc_nfreesegs,
- NULL);
+ NULL, sci->sc_subuf);
nilfs_sufile_warn_on_error(nilfs->ns_sufile, ret);
}
@@ -2552,11 +2554,24 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
struct nilfs_transaction_info ti;
int err;
size_t i, nfreesegs = argv[4].v_nmembs;
+ size_t susz = NILFS_MDT(nilfs->ns_sufile)->mi_entry_size;
__u64 *segnumv = kbufs[4];
+ void *subuf = NULL;
if (unlikely(!sci))
return -EROFS;
+ if (likely(nfreesegs > 0)) {
+ size_t bytes;
+
+ if (check_mul_overflow(nfreesegs, susz, &bytes))
+ return -EINVAL;
+
+ subuf = kvzalloc(bytes, GFP_KERNEL);
+ if (unlikely(!subuf))
+ return -ENOMEM;
+ }
+
nilfs_transaction_lock(sb, &ti, 1);
/*
@@ -2590,6 +2605,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
sci->sc_freesegs = kbufs[4];
sci->sc_nfreesegs = argv[4].v_nmembs;
+ sci->sc_subuf = subuf;
list_splice_tail_init(&nilfs->ns_gc_inodes, &sci->sc_gc_inodes);
for (;;) {
@@ -2619,12 +2635,14 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
}
out_unlock:
+ sci->sc_subuf = NULL;
sci->sc_freesegs = NULL;
sci->sc_nfreesegs = 0;
list_splice_tail_init(&sci->sc_gc_inodes, &nilfs->ns_gc_inodes);
nilfs_mdt_clear_shadow_map(nilfs->ns_dat);
bail_unlock:
nilfs_transaction_unlock(sb);
+ kvfree(subuf);
return err;
}
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index 4b39ed43ae72..e67afc14a82c 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -84,6 +84,7 @@ struct nilfs_segsum_pointer {
* @sc_iput_work: work struct to defer iput call
* @sc_freesegs: array of segment numbers to be freed
* @sc_nfreesegs: number of segments on @sc_freesegs
+ * @sc_subuf: buffer used to save segment entries
* @sc_dsync_inode: inode whose data pages are written for a sync operation
* @sc_dsync_start: start byte offset of data pages
* @sc_dsync_end: end byte offset of data pages (inclusive)
@@ -129,6 +130,7 @@ struct nilfs_sc_info {
__u64 *sc_freesegs;
size_t sc_nfreesegs;
+ void *sc_subuf;
struct nilfs_inode_info *sc_dsync_inode;
loff_t sc_dsync_start;
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index fec5af70c6dd..c8010b9e6d67 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -148,6 +148,7 @@ unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile)
* @nsegs: size of @segnumv array
* @create: creation flag
* @ndone: place to store number of modified segments on @segnumv
+ * @suv: buffer for saving or restoring segment usage entries
* @dofunc: primitive operation for the update
*
* Description: nilfs_sufile_updatev() repeatedly calls @dofunc
@@ -166,15 +167,17 @@ unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile)
* * %-ENOMEM - Insufficient memory available.
*/
int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
- int create, size_t *ndone,
+ int create, size_t *ndone, void *suv,
void (*dofunc)(struct inode *, __u64,
struct buffer_head *,
- struct buffer_head *))
+ struct buffer_head *, void *))
{
struct buffer_head *header_bh, *bh;
unsigned long blkoff, prev_blkoff;
__u64 *seg;
size_t nerr = 0, n = 0;
+ size_t susz = NILFS_MDT(sufile)->mi_entry_size;
+ void *su;
int ret = 0;
if (unlikely(nsegs == 0))
@@ -204,8 +207,8 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
if (ret < 0)
goto out_header;
- for (;;) {
- dofunc(sufile, *seg, header_bh, bh);
+ for (su = suv; ; su = su ? su + susz : NULL) {
+ dofunc(sufile, *seg, header_bh, bh, su);
if (++seg >= segnumv + nsegs)
break;
@@ -236,7 +239,7 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create,
void (*dofunc)(struct inode *, __u64,
struct buffer_head *,
- struct buffer_head *))
+ struct buffer_head *, void *))
{
struct buffer_head *header_bh, *bh;
int ret;
@@ -254,7 +257,7 @@ int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create,
ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, create, &bh);
if (!ret) {
- dofunc(sufile, segnum, header_bh, bh);
+ dofunc(sufile, segnum, header_bh, bh, NULL);
brelse(bh);
}
brelse(header_bh);
@@ -407,7 +410,7 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump)
void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
struct buffer_head *header_bh,
- struct buffer_head *su_bh)
+ struct buffer_head *su_bh, void *buf)
{
struct nilfs_segment_usage *su;
size_t offset;
@@ -420,6 +423,8 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
kunmap_local(su);
return;
}
+ if (buf)
+ memcpy(su, buf, NILFS_MDT(sufile)->mi_entry_size);
nilfs_segment_usage_set_dirty(su);
kunmap_local(su);
@@ -432,7 +437,7 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
void nilfs_sufile_do_scrap(struct inode *sufile, __u64 segnum,
struct buffer_head *header_bh,
- struct buffer_head *su_bh)
+ struct buffer_head *su_bh, void *buf)
{
struct nilfs_segment_usage *su;
size_t offset;
@@ -463,7 +468,7 @@ void nilfs_sufile_do_scrap(struct inode *sufile, __u64 segnum,
void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
struct buffer_head *header_bh,
- struct buffer_head *su_bh)
+ struct buffer_head *su_bh, void *buf)
{
struct nilfs_segment_usage *su;
size_t offset;
@@ -486,6 +491,8 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
nilfs_warn(sufile->i_sb, "free unallocated segment %llu",
(unsigned long long)segnum);
+ if (buf)
+ memcpy(buf, su, NILFS_MDT(sufile)->mi_entry_size);
nilfs_segment_usage_set_clean(su);
kunmap_local(su);
mark_buffer_dirty(su_bh);
@@ -646,7 +653,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat)
void nilfs_sufile_do_set_error(struct inode *sufile, __u64 segnum,
struct buffer_head *header_bh,
- struct buffer_head *su_bh)
+ struct buffer_head *su_bh, void *buf)
{
struct nilfs_segment_usage *su;
size_t offset;
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h
index 5888ed479c8b..34a429664712 100644
--- a/fs/nilfs2/sufile.h
+++ b/fs/nilfs2/sufile.h
@@ -33,22 +33,23 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *, __u64, void *, unsigned int,
size_t);
ssize_t nilfs_sufile_set_suinfo(struct inode *, void *, unsigned int, size_t);
-int nilfs_sufile_updatev(struct inode *, __u64 *, size_t, int, size_t *,
+int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
+ int create, size_t *ndone, void *suv,
void (*dofunc)(struct inode *, __u64,
struct buffer_head *,
- struct buffer_head *));
+ struct buffer_head *, void *));
int nilfs_sufile_update(struct inode *, __u64, int,
void (*dofunc)(struct inode *, __u64,
struct buffer_head *,
- struct buffer_head *));
+ struct buffer_head *, void *));
void nilfs_sufile_do_scrap(struct inode *, __u64, struct buffer_head *,
- struct buffer_head *);
+ struct buffer_head *, void *);
void nilfs_sufile_do_free(struct inode *, __u64, struct buffer_head *,
- struct buffer_head *);
+ struct buffer_head *, void *);
void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *,
- struct buffer_head *);
+ struct buffer_head *, void *);
void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *,
- struct buffer_head *);
+ struct buffer_head *, void *);
int nilfs_sufile_resize(struct inode *sufile, __u64 newnsegs);
int nilfs_sufile_read(struct super_block *sb, size_t susize,
@@ -108,34 +109,36 @@ static inline int nilfs_sufile_free(struct inode *sufile, __u64 segnum)
/**
* nilfs_sufile_freev - free segments
- * @sufile: inode of segment usage file
+ * @sufile: inode of segment usage file
* @segnumv: array of segment numbers
- * @nsegs: size of @segnumv array
- * @ndone: place to store the number of freed segments
+ * @nsegs: size of @segnumv array
+ * @ndone: place to store the number of freed segments
+ * @suv: buffer to save segment usage entries
*
* Return: 0 on success, or a negative error code on failure.
*/
static inline int nilfs_sufile_freev(struct inode *sufile, __u64 *segnumv,
- size_t nsegs, size_t *ndone)
+ size_t nsegs, size_t *ndone, void *suv)
{
- return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone,
+ return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone, suv,
nilfs_sufile_do_free);
}
/**
* nilfs_sufile_cancel_freev - reallocate freeing segments
- * @sufile: inode of segment usage file
+ * @sufile: inode of segment usage file
* @segnumv: array of segment numbers
- * @nsegs: size of @segnumv array
- * @ndone: place to store the number of cancelled segments
+ * @nsegs: size of @segnumv array
+ * @ndone: place to store the number of cancelled segments
+ * @suv: buffer containing saved segment usage entries
*
* Return: 0 on success, or a negative error code on failure.
*/
static inline int nilfs_sufile_cancel_freev(struct inode *sufile,
__u64 *segnumv, size_t nsegs,
- size_t *ndone)
+ size_t *ndone, void *suv)
{
- return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone,
+ return nilfs_sufile_updatev(sufile, segnumv, nsegs, 0, ndone, suv,
nilfs_sufile_do_cancel_free);
}
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] nilfs2: drop redirected buffer flag from DAT when clearing shadow map
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
` (2 preceding siblings ...)
2026-11-27 4:40 ` [PATCH 3/8] nilfs2: restore segment usage from the save buffer when aborting GC Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 5/8] nilfs2: save DAT entry blocks to shadow mapping before freeing Ryusuke Konishi
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
During garbage collection, the nilfs_redirected flag is set on buffer
heads in the primary mapping of the DAT inode when their blocks are
frozen into the shadow map. Normally, this flag is cleared when the
DAT blocks are written out, so it did not cause issues before.
However, since commit ce5a5ad1a833 ("nilfs2: fix infinite loop in
nilfs_clean_segments()"), if GC is aborted due to an error before the
DAT blocks are written, nilfs_mdt_clear_shadow_map() releases the frozen
buffers without clearing the nilfs_redirected flag from the corresponding
primary buffer heads. As a result, stale nilfs_redirected flags remain
on the DAT buffers, causing subsequent GC operations to skip freezing
those buffers into the shadow map.
Fix this by looking up the corresponding buffer head in the primary
mapping of @inode and clearing its nilfs_redirected flag inside
nilfs_release_frozen_buffers().
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/mdt.c | 41 ++++++++++++++++++++++++++++++++++-------
1 file changed, 34 insertions(+), 7 deletions(-)
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 77dc2be2ce65..91b8455e7f94 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -602,16 +602,43 @@ nilfs_mdt_get_frozen_buffer(struct inode *inode, struct buffer_head *bh)
return bh_frozen;
}
-static void nilfs_release_frozen_buffers(struct nilfs_shadow_map *shadow)
+static void nilfs_release_frozen_buffers(struct inode *inode,
+ struct nilfs_shadow_map *shadow)
{
struct list_head *head = &shadow->frozen_buffers;
- struct buffer_head *bh;
+ unsigned int blkbits = inode->i_blkbits;
while (!list_empty(head)) {
- bh = list_first_entry(head, struct buffer_head,
- b_assoc_buffers);
- list_del_init(&bh->b_assoc_buffers);
- brelse(bh); /* drop ref-count to make it releasable */
+ struct buffer_head *bh_frozen, *bh;
+ struct folio *folio;
+ unsigned int n;
+
+ bh_frozen = list_first_entry(head, struct buffer_head,
+ b_assoc_buffers);
+
+ /*
+ * Clear the nilfs_redirected flag from the primary buffer head
+ * corresponding to bh_frozen to ensure that the flag does not
+ * remain on the non-shadow DAT blocks when a GC operation
+ * terminates due to an error.
+ */
+ folio = filemap_lock_folio(inode->i_mapping,
+ bh_frozen->b_folio->index);
+ if (!IS_ERR(folio)) {
+ bh = folio_buffers(folio);
+ if (bh) {
+ n = offset_in_folio(bh_frozen->b_folio,
+ bh_frozen->b_data) >> blkbits;
+ bh = get_nth_bh(bh, n);
+ clear_buffer_nilfs_redirected(bh);
+ brelse(bh);
+ }
+ folio_unlock(folio);
+ folio_put(folio);
+ }
+
+ list_del_init(&bh_frozen->b_assoc_buffers);
+ brelse(bh_frozen); /* drop ref-count to make it releasable */
}
}
@@ -653,7 +680,7 @@ void nilfs_mdt_clear_shadow_map(struct inode *inode)
struct inode *shadow_btnc_inode = NILFS_I(shadow->inode)->i_assoc_inode;
down_write(&mi->mi_sem);
- nilfs_release_frozen_buffers(shadow);
+ nilfs_release_frozen_buffers(inode, shadow);
truncate_inode_pages(shadow->inode->i_mapping, 0);
truncate_inode_pages(shadow_btnc_inode->i_mapping, 0);
up_write(&mi->mi_sem);
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/8] nilfs2: save DAT entry blocks to shadow mapping before freeing
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
` (3 preceding siblings ...)
2026-11-27 4:40 ` [PATCH 4/8] nilfs2: drop redirected buffer flag from DAT when clearing shadow map Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 6/8] nilfs2: restore removed DAT entries when aborting GC Ryusuke Konishi
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
In preparation for restoring removed DAT entries when GC is aborted,
modify nilfs_dat_freev() to freeze the buffer heads of target DAT entry
blocks before freeing virtual block numbers, saving their original
contents in the shadow mapping.
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/dat.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index d2718944368b..b4156945e433 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -11,6 +11,7 @@
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/errno.h>
+#include <linux/math64.h>
#include "nilfs.h"
#include "mdt.h"
#include "alloc.h"
@@ -306,11 +307,48 @@ int nilfs_dat_mark_dirty(struct inode *dat, __u64 vblocknr)
* Return: 0 on success, or one of the following negative error codes on
* failure:
* * %-EIO - I/O error (including metadata corruption).
- * * %-ENOENT - The virtual block number have not been allocated.
+ * * %-ENOENT - An unallocated management block was found.
* * %-ENOMEM - Insufficient memory available.
*/
int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
{
+ unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block;
+ struct buffer_head *entry_bh = NULL;
+ __u64 start_vblocknr = 0, end_vblocknr = 0;
+ u64 rem;
+ size_t i;
+ int ret;
+
+ /* Save the DAT entries to the shadow mapping before removal */
+ for (i = 0; i < nitems; i++) {
+ if (entry_bh && vblocknrs[i] >= start_vblocknr &&
+ vblocknrs[i] < end_vblocknr)
+ continue;
+
+ brelse(entry_bh);
+ entry_bh = NULL;
+
+ ret = nilfs_palloc_get_entry_block(dat, vblocknrs[i], 0,
+ &entry_bh);
+ if (unlikely(ret < 0)) {
+ if (ret != -ENOENT)
+ return ret;
+ continue;
+ }
+ if (!buffer_nilfs_redirected(entry_bh)) {
+ ret = nilfs_mdt_freeze_buffer(dat, entry_bh);
+ if (unlikely(ret < 0)) {
+ brelse(entry_bh);
+ return ret;
+ }
+ }
+
+ div64_u64_rem(vblocknrs[i], entries_per_block, &rem);
+ start_vblocknr = vblocknrs[i] - rem;
+ end_vblocknr = start_vblocknr + entries_per_block;
+ }
+ brelse(entry_bh);
+
return nilfs_palloc_freev(dat, vblocknrs, nitems);
}
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/8] nilfs2: restore removed DAT entries when aborting GC
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
` (4 preceding siblings ...)
2026-11-27 4:40 ` [PATCH 5/8] nilfs2: save DAT entry blocks to shadow mapping before freeing Ryusuke Konishi
@ 2026-11-27 4:40 ` Ryusuke Konishi
2026-11-27 4:41 ` [PATCH 7/8] nilfs2: free virtual block numbers just before collecting DAT changes Ryusuke Konishi
2026-11-27 4:41 ` [PATCH 8/8] nilfs2: avoid infinite retry loop on GC failure Ryusuke Konishi
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:40 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
Since commit ce5a5ad1a833 ("nilfs2: fix infinite loop in
nilfs_clean_segments()"), an escape path was added to exit the GC loop
in nilfs_clean_segments() when GC fails. However, if GC is aborted
due to an error, obsolete virtual block numbers freed from the DAT
metadata file are left deleted, causing subsequent GC runs or userland
tools such as lssu -l (which relies on the DAT to evaluate live blocks)
to fail due to missing DAT entries.
Fix this by restoring the removed DAT entries from the shadow mapping
saved by nilfs_dat_freev() when log construction is aborted during GC.
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/dat.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
fs/nilfs2/dat.h | 1 +
fs/nilfs2/segment.c | 10 ++++++-
fs/nilfs2/segment.h | 4 +++
4 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index b4156945e433..94d358d9d5b0 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -352,6 +352,78 @@ int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
return nilfs_palloc_freev(dat, vblocknrs, nitems);
}
+/**
+ * nilfs_dat_cancel_freev - undo removal of DAT entries
+ * @dat: DAT file inode
+ * @vblocknrs: array of virtual block numbers
+ * @nitems: number of virtual block numbers
+ *
+ * nilfs_dat_cancel_freev() restores freed virtual block numbers specified by
+ * @vblocknrs and @nitems from the shadow mapping.
+ */
+void nilfs_dat_cancel_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
+{
+ unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block;
+ unsigned int entry_size = NILFS_MDT(dat)->mi_entry_size;
+ struct buffer_head *entry_bh = NULL, *saved_bh = NULL;
+ struct nilfs_palloc_req req;
+ __u64 start_vblocknr = 0, end_vblocknr = 0;
+ size_t i;
+
+ for (i = 0; i < nitems; i++) {
+ size_t offset;
+ int ret;
+
+ req.pr_entry_nr = vblocknrs[i];
+ ret = nilfs_palloc_prepare_alloc_entry(dat, &req, false);
+ if (ret < 0)
+ continue;
+
+ if (req.pr_entry_nr != vblocknrs[i])
+ goto abort_alloc_entry;
+
+ if (!saved_bh || vblocknrs[i] < start_vblocknr ||
+ vblocknrs[i] >= end_vblocknr) {
+ u64 rem;
+
+ brelse(saved_bh);
+ saved_bh = NULL;
+ brelse(entry_bh);
+ entry_bh = NULL;
+
+ ret = nilfs_dat_prepare_entry(dat, &req, true);
+ if (ret < 0)
+ goto abort_alloc_entry;
+
+ entry_bh = req.pr_entry_bh;
+
+ saved_bh = nilfs_mdt_get_frozen_buffer(dat, entry_bh);
+ if (!saved_bh) {
+ brelse(entry_bh);
+ entry_bh = NULL;
+ goto abort_alloc_entry;
+ }
+
+ div64_u64_rem(vblocknrs[i], entries_per_block, &rem);
+ start_vblocknr = vblocknrs[i] - rem;
+ end_vblocknr = start_vblocknr + entries_per_block;
+ }
+
+ offset = nilfs_palloc_entry_offset(dat, vblocknrs[i], entry_bh);
+ memcpy_folio(entry_bh->b_folio, offset, saved_bh->b_folio,
+ offset, entry_size);
+ mark_buffer_dirty(entry_bh);
+ nilfs_palloc_commit_alloc_entry(dat, &req);
+ continue;
+
+abort_alloc_entry:
+ nilfs_palloc_abort_alloc_entry(dat, &req);
+ }
+
+ brelse(saved_bh);
+ brelse(entry_bh);
+}
+
/**
* nilfs_dat_move - change a block number
* @dat: DAT file inode
diff --git a/fs/nilfs2/dat.h b/fs/nilfs2/dat.h
index 4f67f31f928b..8e1e52aa9cf7 100644
--- a/fs/nilfs2/dat.h
+++ b/fs/nilfs2/dat.h
@@ -38,6 +38,7 @@ void nilfs_dat_abort_update(struct inode *, struct nilfs_palloc_req *,
int nilfs_dat_mark_dirty(struct inode *, __u64);
int nilfs_dat_freev(struct inode *, __u64 *, size_t);
+void nilfs_dat_cancel_freev(struct inode *dat, __u64 *vblocknrs, size_t items);
int nilfs_dat_move(struct inode *, __u64, sector_t);
void nilfs_dat_undo_move(struct inode *dat, __u64 vblocknr);
ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned int, size_t);
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 263f9ff00193..f3c12c14c750 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1909,8 +1909,12 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
if (list_empty(&logs))
return; /* if the first segment buffer preparation failed */
- if (nilfs_doing_gc())
+ if (nilfs_doing_gc()) {
nilfs_cancel_block_relocation(&logs);
+ nilfs_dat_cancel_freev(nilfs->ns_dat, sci->sc_freevblks,
+ sci->sc_nfreevblks);
+ }
+
nilfs_cancel_segusage(&logs, nilfs->ns_sufile);
nilfs_free_incomplete_logs(&logs, nilfs);
@@ -2605,6 +2609,8 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
sci->sc_freesegs = kbufs[4];
sci->sc_nfreesegs = argv[4].v_nmembs;
+ sci->sc_freevblks = kbufs[2];
+ sci->sc_nfreevblks = argv[2].v_nmembs;
sci->sc_subuf = subuf;
list_splice_tail_init(&nilfs->ns_gc_inodes, &sci->sc_gc_inodes);
@@ -2636,6 +2642,8 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
out_unlock:
sci->sc_subuf = NULL;
+ sci->sc_freevblks = NULL;
+ sci->sc_nfreevblks = 0;
sci->sc_freesegs = NULL;
sci->sc_nfreesegs = 0;
list_splice_tail_init(&sci->sc_gc_inodes, &nilfs->ns_gc_inodes);
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index e67afc14a82c..711c69e24575 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -83,7 +83,9 @@ struct nilfs_segsum_pointer {
* @sc_iput_queue: list of inodes for which iput should be done
* @sc_iput_work: work struct to defer iput call
* @sc_freesegs: array of segment numbers to be freed
+ * @sc_freevblks: array of virtual block numbers to be freed
* @sc_nfreesegs: number of segments on @sc_freesegs
+ * @sc_nfreevblks: number of virtual block numbers on @sc_freevblks
* @sc_subuf: buffer used to save segment entries
* @sc_dsync_inode: inode whose data pages are written for a sync operation
* @sc_dsync_start: start byte offset of data pages
@@ -129,7 +131,9 @@ struct nilfs_sc_info {
struct work_struct sc_iput_work;
__u64 *sc_freesegs;
+ __u64 *sc_freevblks;
size_t sc_nfreesegs;
+ size_t sc_nfreevblks;
void *sc_subuf;
struct nilfs_inode_info *sc_dsync_inode;
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7/8] nilfs2: free virtual block numbers just before collecting DAT changes
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
` (5 preceding siblings ...)
2026-11-27 4:40 ` [PATCH 6/8] nilfs2: restore removed DAT entries when aborting GC Ryusuke Konishi
@ 2026-11-27 4:41 ` Ryusuke Konishi
2026-11-27 4:41 ` [PATCH 8/8] nilfs2: avoid infinite retry loop on GC failure Ryusuke Konishi
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:41 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
During garbage collection, obsolete virtual block numbers were previously
freed from the DAT file at the beginning of the GC ioctl in
nilfs_ioctl_prepare_clean_segments(). Because this occurred before
collecting dirty blocks for the new log, those freed DAT entries could
theoretically be reallocated during log construction, making it
impossible to cancel the deallocation and recover consistent state if
construction is aborted.
Move the deallocation via nilfs_dat_freev() to the NILFS_ST_DAT stage
in nilfs_segctor_collect_blocks(), right before collecting dirty DAT
blocks, where freeing DAT entries cannot cause virtual block
reallocation. Also extend nilfs_palloc_freev() and nilfs_dat_freev()
to report the number of processed entries, and track the deallocation
state with NILFS_CF_VBKFREED so freed DAT entries are reliably restored
on abort.
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/alloc.c | 14 ++++++++++----
fs/nilfs2/alloc.h | 3 ++-
fs/nilfs2/dat.c | 15 +++++++++++----
fs/nilfs2/dat.h | 3 ++-
fs/nilfs2/ioctl.c | 36 +-----------------------------------
fs/nilfs2/segment.c | 29 +++++++++++++++++++++++++----
6 files changed, 51 insertions(+), 49 deletions(-)
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c
index 7b1cd2baefcf..bc67b211ac55 100644
--- a/fs/nilfs2/alloc.c
+++ b/fs/nilfs2/alloc.c
@@ -815,10 +815,12 @@ void nilfs_palloc_abort_free_entry(struct inode *inode,
* @inode: inode of metadata file using this allocator
* @entry_nrs: array of entry numbers to be deallocated
* @nitems: number of entries stored in @entry_nrs
+ * @ndone: place to store the number of process entries
*
* Return: 0 on success, or a negative error code on failure.
*/
-int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
+int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems,
+ size_t *ndone)
{
struct buffer_head *desc_bh, *bitmap_bh;
struct nilfs_palloc_group_desc *desc;
@@ -840,12 +842,12 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
group = nilfs_palloc_group(inode, entry_nrs[i], &group_offset);
ret = nilfs_palloc_get_desc_block(inode, group, 0, &desc_bh);
if (ret < 0)
- return ret;
+ goto fail;
ret = nilfs_palloc_get_bitmap_block(inode, group, 0,
&bitmap_bh);
if (ret < 0) {
brelse(desc_bh);
- return ret;
+ goto fail;
}
/* Get the first entry number of the group */
@@ -927,7 +929,11 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
ret, group, inode->i_ino);
}
}
- return 0;
+ ret = 0;
+fail:
+ if (ndone)
+ *ndone = i;
+ return ret;
}
void nilfs_palloc_setup_cache(struct inode *inode,
diff --git a/fs/nilfs2/alloc.h b/fs/nilfs2/alloc.h
index 046d876ea3e0..0028d74c694d 100644
--- a/fs/nilfs2/alloc.h
+++ b/fs/nilfs2/alloc.h
@@ -60,7 +60,8 @@ void nilfs_palloc_abort_alloc_entry(struct inode *, struct nilfs_palloc_req *);
void nilfs_palloc_commit_free_entry(struct inode *, struct nilfs_palloc_req *);
int nilfs_palloc_prepare_free_entry(struct inode *, struct nilfs_palloc_req *);
void nilfs_palloc_abort_free_entry(struct inode *, struct nilfs_palloc_req *);
-int nilfs_palloc_freev(struct inode *, __u64 *, size_t);
+int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems,
+ size_t *ndone);
#define nilfs_set_bit_atomic ext2_set_bit_atomic
#define nilfs_clear_bit_atomic ext2_clear_bit_atomic
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index 94d358d9d5b0..515f4243c7b5 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -300,6 +300,7 @@ int nilfs_dat_mark_dirty(struct inode *dat, __u64 vblocknr)
* @dat: DAT file inode
* @vblocknrs: array of virtual block numbers
* @nitems: number of virtual block numbers
+ * @ndone: location to store the number of freed virtual block numbers
*
* Description: nilfs_dat_freev() frees the virtual block numbers specified by
* @vblocknrs and @nitems.
@@ -310,7 +311,8 @@ int nilfs_dat_mark_dirty(struct inode *dat, __u64 vblocknr)
* * %-ENOENT - An unallocated management block was found.
* * %-ENOMEM - Insufficient memory available.
*/
-int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
+int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems,
+ size_t *ndone)
{
unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block;
struct buffer_head *entry_bh = NULL;
@@ -332,14 +334,14 @@ int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
&entry_bh);
if (unlikely(ret < 0)) {
if (ret != -ENOENT)
- return ret;
+ goto failed;
continue;
}
if (!buffer_nilfs_redirected(entry_bh)) {
ret = nilfs_mdt_freeze_buffer(dat, entry_bh);
if (unlikely(ret < 0)) {
brelse(entry_bh);
- return ret;
+ goto failed;
}
}
@@ -349,7 +351,12 @@ int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
}
brelse(entry_bh);
- return nilfs_palloc_freev(dat, vblocknrs, nitems);
+ return nilfs_palloc_freev(dat, vblocknrs, nitems, ndone);
+
+failed:
+ if (ndone)
+ *ndone = 0;
+ return ret;
}
/**
diff --git a/fs/nilfs2/dat.h b/fs/nilfs2/dat.h
index 8e1e52aa9cf7..9eb17ef2bb63 100644
--- a/fs/nilfs2/dat.h
+++ b/fs/nilfs2/dat.h
@@ -37,7 +37,8 @@ void nilfs_dat_abort_update(struct inode *, struct nilfs_palloc_req *,
struct nilfs_palloc_req *);
int nilfs_dat_mark_dirty(struct inode *, __u64);
-int nilfs_dat_freev(struct inode *, __u64 *, size_t);
+int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t items,
+ size_t *ndone);
void nilfs_dat_cancel_freev(struct inode *dat, __u64 *vblocknrs, size_t items);
int nilfs_dat_move(struct inode *, __u64, sector_t);
void nilfs_dat_undo_move(struct inode *dat, __u64 vblocknr);
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 686ac53498bc..a46dad335ee5 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -701,32 +701,6 @@ static int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs,
return nmembs;
}
-/**
- * nilfs_ioctl_free_vblocknrs - free virtual block numbers
- * @nilfs: nilfs object
- * @argv: vector of arguments from userspace
- * @buf: array of virtual block numbers
- *
- * Description: nilfs_ioctl_free_vblocknrs() function frees
- * the virtual block numbers specified by @buf and @argv->v_nmembs.
- *
- * Return: Number of processed virtual block numbers on success, or one of the
- * following negative error codes on failure:
- * * %-EIO - I/O error.
- * * %-ENOENT - Unallocated virtual block number.
- * * %-ENOMEM - Insufficient memory available.
- */
-static int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs,
- struct nilfs_argv *argv, void *buf)
-{
- size_t nmembs = argv->v_nmembs;
- int ret;
-
- ret = nilfs_dat_freev(nilfs->ns_dat, buf, nmembs);
-
- return (ret < 0) ? ret : nmembs;
-}
-
/**
* nilfs_ioctl_mark_blocks_dirty - mark blocks dirty
* @nilfs: nilfs object
@@ -809,15 +783,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
msg = "cannot delete checkpoints";
goto failed;
}
- ret = nilfs_ioctl_free_vblocknrs(nilfs, &argv[2], kbufs[2]);
- if (ret < 0) {
- /*
- * can safely abort because DAT file is updated atomically
- * using a copy-on-write technique.
- */
- msg = "cannot delete virtual blocks from DAT file";
- goto failed;
- }
+
ret = nilfs_ioctl_mark_blocks_dirty(nilfs, &argv[3], kbufs[3]);
if (ret < 0) {
/*
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index f3c12c14c750..b306f09c9497 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -107,8 +107,10 @@ static inline int nilfs_sc_cstage_get(struct nilfs_sc_info *sci)
/* State flags of collection */
#define NILFS_CF_NODE 0x0001 /* Collecting node blocks */
#define NILFS_CF_IFILE_STARTED 0x0002 /* IFILE stage has started */
-#define NILFS_CF_SUFREED 0x0004 /* segment usages has been freed */
-#define NILFS_CF_HISTORY_MASK (NILFS_CF_IFILE_STARTED | NILFS_CF_SUFREED)
+#define NILFS_CF_SUFREED 0x0004 /* segment usages have been freed */
+#define NILFS_CF_VBKFREED 0x0008 /* DAT entries have been freed */
+#define NILFS_CF_HISTORY_MASK (NILFS_CF_IFILE_STARTED | NILFS_CF_SUFREED | \
+ NILFS_CF_VBKFREED)
/* Operations depending on the construction mode and file type */
struct nilfs_sc_operations {
@@ -1271,6 +1273,18 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
nilfs_sc_cstage_inc(sci);
fallthrough;
case NILFS_ST_DAT:
+ if (sci->sc_nfreevblks > 0) {
+ size_t ndone;
+
+ err = nilfs_dat_freev(nilfs->ns_dat, sci->sc_freevblks,
+ sci->sc_nfreevblks, &ndone);
+ if (unlikely(err)) {
+ nilfs_dat_cancel_freev(nilfs->ns_dat,
+ sci->sc_freevblks, ndone);
+ break;
+ }
+ sci->sc_stage.flags |= NILFS_CF_VBKFREED;
+ }
dat_stage:
err = nilfs_segctor_scan_file(sci, nilfs->ns_dat,
&nilfs_sc_dat_ops);
@@ -1563,6 +1577,12 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
nilfs_clear_logs(&sci->sc_segbufs);
+ if (sci->sc_stage.flags & NILFS_CF_VBKFREED) {
+ nilfs_dat_cancel_freev(nilfs->ns_dat,
+ sci->sc_freevblks, sci->sc_nfreevblks);
+ sci->sc_stage.flags &= ~NILFS_CF_VBKFREED;
+ }
+
if (sci->sc_stage.flags & NILFS_CF_SUFREED) {
err = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
sci->sc_freesegs,
@@ -1909,11 +1929,12 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
if (list_empty(&logs))
return; /* if the first segment buffer preparation failed */
- if (nilfs_doing_gc()) {
+ if (nilfs_doing_gc())
nilfs_cancel_block_relocation(&logs);
+
+ if (sci->sc_stage.flags & NILFS_CF_VBKFREED)
nilfs_dat_cancel_freev(nilfs->ns_dat, sci->sc_freevblks,
sci->sc_nfreevblks);
- }
nilfs_cancel_segusage(&logs, nilfs->ns_sufile);
nilfs_free_incomplete_logs(&logs, nilfs);
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 8/8] nilfs2: avoid infinite retry loop on GC failure
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
` (6 preceding siblings ...)
2026-11-27 4:41 ` [PATCH 7/8] nilfs2: free virtual block numbers just before collecting DAT changes Ryusuke Konishi
@ 2026-11-27 4:41 ` Ryusuke Konishi
7 siblings, 0 replies; 9+ messages in thread
From: Ryusuke Konishi @ 2026-11-27 4:41 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Wang Jianjian, linux-nilfs, LKML, Zheng Zheng, Joshua Crofts
Currently, the GC loop in nilfs_clean_segments() only breaks out when
nilfs_segctor_construct() returns -EROFS, continuing to retry on any
other error. When a persistent or non-retryable error such as -EIO or
-ENOSPC occurs during log writing due to filesystem corruption, I/O
errors, or free space exhaustion, this loop can spin indefinitely while
holding the transaction lock, leading to task hangs.
Now that GC-specific state changes can be selectively reverted on log
writing failure to preserve filesystem consistency for subsequent
operations, modify nilfs_clean_segments() to abort immediately on
errors in general, leaving only a minimal retry loop bounded by
NILFS_GC_RETRY_LIMIT for -EAGAIN and -EBUSY.
Fixes: ce5a5ad1a833 ("nilfs2: fix infinite loop in nilfs_clean_segments()")
Reported-by: Zheng Zheng <fengaojigui88@gmail.com>
Closes: https://lore.kernel.org/linux-nilfs/CAO-4RZ1Q-HzRCd+S1uHZJRdN-ZCtv47f=pXTxbq4YaJgn_DALQ@mail.gmail.com
Closes: https://lore.kernel.org/linux-nilfs/CAO-4RZ2pjEOpTBzqca5UxZHtaFS2Dj9zmNj1BtjvKm1yFE7_Jg@mail.gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
fs/nilfs2/segment.c | 9 ++++++++-
fs/nilfs2/segment.h | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index b306f09c9497..5765959617fe 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2582,6 +2582,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
size_t susz = NILFS_MDT(nilfs->ns_sufile)->mi_entry_size;
__u64 *segnumv = kbufs[4];
void *subuf = NULL;
+ unsigned int retries = 0;
if (unlikely(!sci))
return -EROFS;
@@ -2644,7 +2645,13 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
nilfs_warn(sb, "error %d cleaning segments", err);
- if (unlikely(err == -EROFS))
+ /*
+ * Although the log writer should not have any paths returning
+ * retryable errors (-EAGAIN or -EBUSY), keep a bounded retry
+ * path conservatively.
+ */
+ if ((err != -EAGAIN && err != -EBUSY) ||
+ retries++ >= NILFS_GC_RETRY_LIMIT)
goto out_unlock;
set_current_state(TASK_INTERRUPTIBLE);
diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
index 711c69e24575..4158948d890d 100644
--- a/fs/nilfs2/segment.h
+++ b/fs/nilfs2/segment.h
@@ -204,6 +204,7 @@ enum {
* Retry count of construction when
* destroying segctord
*/
+#define NILFS_GC_RETRY_LIMIT 2 /* Number of internal GC retries */
/*
* Default values of timeout, in seconds.
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-27 4:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 4:40 [PATCH 0/8] nilfs2: support GC error rollback and avoid infinite retry hangs Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 1/8] nilfs2: fix leak of gc inodes on error Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 2/8] nilfs2: cancel the relocation of GC-targeted blocks if log writing fails Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 3/8] nilfs2: restore segment usage from the save buffer when aborting GC Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 4/8] nilfs2: drop redirected buffer flag from DAT when clearing shadow map Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 5/8] nilfs2: save DAT entry blocks to shadow mapping before freeing Ryusuke Konishi
2026-11-27 4:40 ` [PATCH 6/8] nilfs2: restore removed DAT entries when aborting GC Ryusuke Konishi
2026-11-27 4:41 ` [PATCH 7/8] nilfs2: free virtual block numbers just before collecting DAT changes Ryusuke Konishi
2026-11-27 4:41 ` [PATCH 8/8] nilfs2: avoid infinite retry loop on GC failure Ryusuke Konishi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®