[Help] Kernel RCU stall caused by logrotate - F4-424 TOS 6.0.794 - kernel 6.1.120+ #52
Posted: 07 Apr 2026, 02:45
Hello, I am experiencing intermittent complete network outages on my TerraMaster F4-424 NAS running TOS 6.0.794, where the device becomes fully unreachable and requires a hard reboot to recover, and after extensive debugging I have identified the root cause as a kernel RCU stall triggered by the default logrotate configuration interacting with a bug in kernel 6.1.120+ #52.
Hardware: TerraMaster F4-424
TOS version: TOS 6.0.794
Kernel: 6.1.120+ #52 SMP PREEMPT_DYNAMIC (built Thu Nov 27 09:25:39 CST 2025)
CPU: Intel N95
RAM: 8GB
PROBLEM DESCRIPTION:
The NAS becomes completely unreachable on the network intermittently, requiring a hard reboot to recover. During the outage, LAN LEDs remain active but the device does not respond to ping, SSH, or web interface. HDDs also stop spinning during the event.
Analysis of kern.log and syslog from the debug log reveals that the system experienced a kernel RCU stall triggered by the daily logrotate process.
Timeline of the event on April 5, 2026:
- 04:00:21 - logrotate started, first RCU stall detected
- 04:00 to 10:59 - continuous RCU stall warnings every ~60 seconds, same PID (1068593, logrotate)
- 10:59 - last log entry, kernel too frozen to write further
- 11:02 - network monitor script last entry
- 16:09 - external monitoring alert: NAS unreachable
The kernel was in a degraded state for approximately 7 hours before logging stopped, and approximately 12 hours total before the device became completely unreachable.
EVIDENCE FROM KERN.LOG:
Apr 5 04:00:21 TNAS kernel: [458783.118729] rcu: INFO: rcu_preempt self-detected stall on CPU
Apr 5 04:00:21 TNAS kernel: [458783.118750] CPU: 1 PID: 1068593 Comm: logrotate Tainted: G O 6.1.120+ #52
Apr 5 04:00:21 TNAS kernel: [458783.118754] RIP: 0010:filemap_fault+0x5e4/0x900
Apr 5 04:01:24 TNAS kernel: [458846.121728] rcu: INFO: rcu_preempt self-detected stall on CPU
Apr 5 04:01:24 TNAS kernel: [458846.121744] CPU: 1 PID: 1068593 Comm: logrotate Tainted: G O 6.1.120+ #52
[...same pattern repeating every ~60 seconds until 10:59...]
Apr 5 10:59:20 TNAS kernel: [483921.315650] rcu: INFO: rcu_preempt self-detected stall on CPU
[no further log entries after this]
LOGROTATE CONFIGURATION (default TOS config):
/var/log/* /var/log/**/* {
rotate 0
size 1M
missingok
copytruncate
notifempty
}
The "copytruncate" option requires memory-mapped file access which appears to trigger an infinite loop in the filemap_fault kernel function, causing the RCU stall.
WORKAROUND APPLIED:
Removed "copytruncate" from /etc/logrotate.conf and changed "rotate 0" to "rotate 1":
/var/log/* /var/log/**/* {
rotate 1
size 1M
missingok
notifempty
}
After applying this change, logrotate ran successfully in 22ms without any RCU stall.
ADDITIONAL NOTES:
- This issue is NOT related to BTRFS. The /var/log filesystem is ext4 on /dev/md9.
- The issue appears to be a kernel bug in 6.1.120+ #52 specific to the copytruncate + filemap_fault combination.
- The same logrotate configuration ran without issues for approximately 2 months after initial setup (January 2026), suggesting the log files gradually grew large enough to trigger the bug more frequently.
Hardware: TerraMaster F4-424
TOS version: TOS 6.0.794
Kernel: 6.1.120+ #52 SMP PREEMPT_DYNAMIC (built Thu Nov 27 09:25:39 CST 2025)
CPU: Intel N95
RAM: 8GB
PROBLEM DESCRIPTION:
The NAS becomes completely unreachable on the network intermittently, requiring a hard reboot to recover. During the outage, LAN LEDs remain active but the device does not respond to ping, SSH, or web interface. HDDs also stop spinning during the event.
Analysis of kern.log and syslog from the debug log reveals that the system experienced a kernel RCU stall triggered by the daily logrotate process.
Timeline of the event on April 5, 2026:
- 04:00:21 - logrotate started, first RCU stall detected
- 04:00 to 10:59 - continuous RCU stall warnings every ~60 seconds, same PID (1068593, logrotate)
- 10:59 - last log entry, kernel too frozen to write further
- 11:02 - network monitor script last entry
- 16:09 - external monitoring alert: NAS unreachable
The kernel was in a degraded state for approximately 7 hours before logging stopped, and approximately 12 hours total before the device became completely unreachable.
EVIDENCE FROM KERN.LOG:
Apr 5 04:00:21 TNAS kernel: [458783.118729] rcu: INFO: rcu_preempt self-detected stall on CPU
Apr 5 04:00:21 TNAS kernel: [458783.118750] CPU: 1 PID: 1068593 Comm: logrotate Tainted: G O 6.1.120+ #52
Apr 5 04:00:21 TNAS kernel: [458783.118754] RIP: 0010:filemap_fault+0x5e4/0x900
Apr 5 04:01:24 TNAS kernel: [458846.121728] rcu: INFO: rcu_preempt self-detected stall on CPU
Apr 5 04:01:24 TNAS kernel: [458846.121744] CPU: 1 PID: 1068593 Comm: logrotate Tainted: G O 6.1.120+ #52
[...same pattern repeating every ~60 seconds until 10:59...]
Apr 5 10:59:20 TNAS kernel: [483921.315650] rcu: INFO: rcu_preempt self-detected stall on CPU
[no further log entries after this]
LOGROTATE CONFIGURATION (default TOS config):
/var/log/* /var/log/**/* {
rotate 0
size 1M
missingok
copytruncate
notifempty
}
The "copytruncate" option requires memory-mapped file access which appears to trigger an infinite loop in the filemap_fault kernel function, causing the RCU stall.
WORKAROUND APPLIED:
Removed "copytruncate" from /etc/logrotate.conf and changed "rotate 0" to "rotate 1":
/var/log/* /var/log/**/* {
rotate 1
size 1M
missingok
notifempty
}
After applying this change, logrotate ran successfully in 22ms without any RCU stall.
ADDITIONAL NOTES:
- This issue is NOT related to BTRFS. The /var/log filesystem is ext4 on /dev/md9.
- The issue appears to be a kernel bug in 6.1.120+ #52 specific to the copytruncate + filemap_fault combination.
- The same logrotate configuration ran without issues for approximately 2 months after initial setup (January 2026), suggesting the log files gradually grew large enough to trigger the bug more frequently.