Jan Kara
ac8a2e0d28
quota: Fix race of dquot_scan_active() with quota deactivation
...
[ Upstream commit e93ab401da ]
dquot_scan_active() can race with quota deactivation in
quota_release_workfn() like:
CPU0 (quota_release_workfn) CPU1 (dquot_scan_active)
============================== ==============================
spin_lock(&dq_list_lock);
list_replace_init(
&releasing_dquots, &rls_head);
/* dquot X on rls_head,
dq_count == 0,
DQ_ACTIVE_B still set */
spin_unlock(&dq_list_lock);
synchronize_srcu(&dquot_srcu);
spin_lock(&dq_list_lock);
list_for_each_entry(dquot,
&inuse_list, dq_inuse) {
/* finds dquot X */
dquot_active(X) -> true
atomic_inc(&X->dq_count);
}
spin_unlock(&dq_list_lock);
spin_lock(&dq_list_lock);
dquot = list_first_entry(&rls_head);
WARN_ON_ONCE(atomic_read(&dquot->dq_count));
The problem is not only a cosmetic one as under memory pressure the
caller of dquot_scan_active() can end up working on freed dquot.
Fix the problem by making sure the dquot is removed from releasing list
when we acquire a reference to it.
Fixes: 869b6ea160 ("quota: Fix slow quotaoff")
Reported-by: Sam Sun <samsun1006219@gmail.com >
Link: https://lore.kernel.org/all/CAEkJfYPTt3uP1vAYnQ5V2ZWn5O9PLhhGi5HbOcAzyP9vbXyjeg@mail.gmail.com
Signed-off-by: Jan Kara <jack@suse.cz >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-06-01 17:39:14 +02:00
..
2024-12-19 18:08:54 +01:00
2025-10-19 16:23:05 +02:00
2026-03-25 11:03:08 +01:00
2026-03-04 07:19:30 -05:00
2025-06-04 14:40:14 +02:00
2026-03-25 11:03:03 +01:00
2026-03-25 11:03:07 +01:00
2026-04-11 14:16:21 +02:00
2026-01-11 15:18:30 +01:00
2026-01-11 15:19:26 +01:00
2026-06-01 17:38:41 +02:00
2025-03-07 16:56:42 +01:00
2026-04-11 14:16:05 +02:00
2025-06-27 11:07:08 +01:00
2024-12-14 19:54:53 +01:00
2025-12-07 06:12:39 +09:00
2025-12-07 06:12:40 +09:00
2025-09-04 15:26:27 +02:00
2026-03-04 07:19:21 -05:00
2026-03-04 07:19:21 -05:00
2025-04-25 10:43:52 +02:00
2026-01-11 15:19:21 +01:00
2025-02-21 13:49:29 +01:00
2025-06-27 11:07:24 +01:00
2026-01-11 15:18:36 +01:00
2025-09-09 18:54:11 +02:00
2026-03-25 11:03:01 +01:00
2025-12-07 06:12:13 +09:00
2026-03-04 07:19:42 -05:00
2025-02-21 13:50:04 +01:00
2026-03-04 07:19:57 -05:00
2026-01-11 15:19:11 +01:00
2025-09-19 16:29:56 +02:00
2025-10-15 11:56:22 +02:00
2025-07-06 10:57:59 +02:00
2025-04-10 14:33:38 +02:00
2025-06-04 14:40:25 +02:00
2025-04-10 14:33:35 +02:00
2026-03-04 07:20:14 -05:00
2025-09-11 17:19:15 +02:00
2025-10-29 14:04:30 +01:00
2026-06-01 17:39:10 +02:00
2024-12-14 19:54:55 +01:00
2026-06-01 17:38:52 +02:00
2026-04-11 14:16:08 +02:00
2026-06-01 17:39:05 +02:00
2024-12-14 19:54:49 +01:00
2025-02-21 13:50:04 +01:00
2024-12-14 19:54:37 +01:00
2026-06-01 17:38:45 +02:00
2025-12-07 06:12:10 +09:00
2026-01-11 15:18:26 +01:00
2026-01-11 15:18:35 +01:00
2025-12-07 06:12:14 +09:00
2026-06-01 17:38:56 +02:00
2026-03-04 07:19:40 -05:00
2026-06-01 17:38:45 +02:00
2026-01-11 15:19:01 +01:00
2025-06-27 11:07:24 +01:00
2025-12-07 06:12:38 +09:00
2025-06-04 14:40:22 +02:00
2026-03-25 11:03:14 +01:00
2025-07-06 10:57:58 +02:00
2025-08-28 16:25:48 +02:00
2025-03-28 21:58:48 +01:00
2026-01-11 15:18:29 +01:00
2026-01-11 15:19:23 +01:00
2025-08-28 16:25:58 +02:00
2026-03-25 11:03:01 +01:00
2025-04-10 14:33:31 +02:00
2025-03-28 21:58:53 +01:00
2024-12-27 13:53:00 +01:00
2025-02-21 13:50:09 +01:00
2026-03-25 11:02:54 +01:00
2025-08-28 16:26:17 +02:00
2025-07-06 10:58:04 +02:00
2025-02-21 13:49:20 +01:00
2026-01-11 15:19:11 +01:00
2025-12-07 06:12:39 +09:00
2026-02-06 16:43:57 +01:00
2026-06-01 17:38:38 +02:00
2024-12-14 19:54:46 +01:00
2026-02-06 16:44:04 +01:00
2025-06-04 14:40:08 +02:00
2025-12-07 06:12:42 +09:00
2025-12-07 06:12:35 +09:00
2025-08-28 16:26:12 +02:00
2025-10-15 11:56:23 +02:00
2026-03-25 11:03:14 +01:00
2026-01-17 16:39:26 +01:00
2026-06-01 17:39:06 +02:00
2026-06-01 17:39:06 +02:00
2025-06-04 14:40:12 +02:00
2026-04-11 14:16:06 +02:00
2026-01-17 16:39:33 +01:00
2026-01-11 15:18:35 +01:00
2025-09-04 15:26:26 +02:00
2026-01-11 15:18:35 +01:00
2025-04-25 10:43:52 +02:00
2025-03-28 21:58:52 +01:00
2026-02-06 16:44:20 +01:00
2026-06-01 17:39:10 +02:00
2025-10-02 13:40:42 +02:00
2025-12-07 06:12:14 +09:00
2026-01-17 16:39:32 +01:00
2025-02-21 13:50:11 +01:00
2026-03-25 11:02:54 +01:00
2025-06-04 14:40:16 +02:00
2025-09-19 16:29:55 +02:00
2026-01-11 15:19:27 +01:00
2025-06-04 14:40:25 +02:00
2025-02-21 13:48:56 +01:00
2025-10-29 14:04:40 +01:00
2025-01-23 17:17:12 +01:00
2026-02-06 16:44:03 +01:00
2025-08-15 12:04:54 +02:00
2025-08-15 12:05:03 +02:00
2024-12-14 19:54:28 +01:00
2024-12-19 18:08:53 +01:00
2025-03-07 16:56:51 +01:00
2026-06-01 17:39:14 +02:00
2026-06-01 17:38:48 +02:00
2026-01-11 15:18:18 +01:00
2025-06-04 14:40:16 +02:00
2025-06-04 14:40:16 +02:00
2026-01-11 15:18:48 +01:00
2026-04-11 14:16:06 +02:00
2024-12-14 19:54:31 +01:00
2026-06-01 17:38:48 +02:00
2025-02-01 18:30:05 +01:00
2026-03-25 11:03:25 +01:00
2026-01-11 15:19:23 +01:00
2025-12-07 06:12:21 +09:00
2026-03-25 11:03:18 +01:00
2026-03-04 07:19:29 -05:00
2026-06-01 17:39:05 +02:00
2024-12-19 18:08:59 +01:00
2026-03-25 11:03:19 +01:00
2025-12-07 06:12:39 +09:00
2025-12-07 06:12:30 +09:00
2025-10-02 13:40:37 +02:00
2026-04-11 14:16:35 +02:00
2026-02-06 16:43:57 +01:00
2025-10-29 14:04:32 +01:00
2026-06-01 17:38:48 +02:00
2026-01-11 15:19:13 +01:00
2025-01-02 10:30:54 +01:00
2025-06-04 14:40:03 +02:00
2025-06-04 14:40:03 +02:00
2026-01-11 15:19:26 +01:00
2025-05-18 08:21:24 +02:00
2026-03-04 07:19:44 -05:00
2026-03-25 11:03:19 +01:00
2026-06-01 17:38:43 +02:00
2026-01-11 15:18:31 +01:00
2025-08-28 16:25:59 +02:00
2025-09-09 18:54:17 +02:00
2025-01-02 10:30:48 +01:00
2025-08-15 12:05:09 +02:00
2024-12-27 13:53:01 +01:00