Skip to content

Commit c0fb830

Browse files
jankaraakpm00
authored andcommitted
ocfs2: switch osb->disable_recovery to enum
Patch series "ocfs2: Fix deadlocks in quota recovery", v3. This implements another approach to fixing quota recovery deadlocks. We avoid grabbing sb->s_umount semaphore from ocfs2_finish_quota_recovery() and instead stop quota recovery early in ocfs2_dismount_volume(). This patch (of 3): We will need more recovery states than just pure enable / disable to fix deadlocks with quota recovery. Switch osb->disable_recovery to enum. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: 5f530de ("ocfs2: Use s_umount for quota recovery protection") Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Heming Zhao <[email protected]> Tested-by: Heming Zhao <[email protected]> Acked-by: Joseph Qi <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Jun Piao <[email protected]> Cc: Murad Masimov <[email protected]> Cc: Shichangkuo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 80fbee7 commit c0fb830

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

fs/ocfs2/journal.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ int ocfs2_recovery_init(struct ocfs2_super *osb)
174174
struct ocfs2_recovery_map *rm;
175175

176176
mutex_init(&osb->recovery_lock);
177-
osb->disable_recovery = 0;
177+
osb->recovery_state = OCFS2_REC_ENABLED;
178178
osb->recovery_thread_task = NULL;
179179
init_waitqueue_head(&osb->recovery_event);
180180

@@ -206,7 +206,7 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
206206
/* disable any new recovery threads and wait for any currently
207207
* running ones to exit. Do this before setting the vol_state. */
208208
mutex_lock(&osb->recovery_lock);
209-
osb->disable_recovery = 1;
209+
osb->recovery_state = OCFS2_REC_DISABLED;
210210
mutex_unlock(&osb->recovery_lock);
211211
wait_event(osb->recovery_event, !ocfs2_recovery_thread_running(osb));
212212

@@ -1582,14 +1582,16 @@ static int __ocfs2_recovery_thread(void *arg)
15821582

15831583
void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
15841584
{
1585+
int was_set = -1;
1586+
15851587
mutex_lock(&osb->recovery_lock);
1588+
if (osb->recovery_state < OCFS2_REC_DISABLED)
1589+
was_set = ocfs2_recovery_map_set(osb, node_num);
15861590

15871591
trace_ocfs2_recovery_thread(node_num, osb->node_num,
1588-
osb->disable_recovery, osb->recovery_thread_task,
1589-
osb->disable_recovery ?
1590-
-1 : ocfs2_recovery_map_set(osb, node_num));
1592+
osb->recovery_state, osb->recovery_thread_task, was_set);
15911593

1592-
if (osb->disable_recovery)
1594+
if (osb->recovery_state == OCFS2_REC_DISABLED)
15931595
goto out;
15941596

15951597
if (osb->recovery_thread_task)

fs/ocfs2/ocfs2.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ enum ocfs2_journal_trigger_type {
308308
void ocfs2_initialize_journal_triggers(struct super_block *sb,
309309
struct ocfs2_triggers triggers[]);
310310

311+
enum ocfs2_recovery_state {
312+
OCFS2_REC_ENABLED = 0,
313+
OCFS2_REC_DISABLED,
314+
};
315+
311316
struct ocfs2_journal;
312317
struct ocfs2_slot_info;
313318
struct ocfs2_recovery_map;
@@ -370,7 +375,7 @@ struct ocfs2_super
370375
struct ocfs2_recovery_map *recovery_map;
371376
struct ocfs2_replay_map *replay_map;
372377
struct task_struct *recovery_thread_task;
373-
int disable_recovery;
378+
enum ocfs2_recovery_state recovery_state;
374379
wait_queue_head_t checkpoint_event;
375380
struct ocfs2_journal *journal;
376381
unsigned long osb_commit_interval;

0 commit comments

Comments
 (0)