Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfd97a03 authored by jiangyiwen's avatar jiangyiwen Committed by Linus Torvalds
Browse files

ocfs2: use spinlock_irqsave() to downconvert lock in ocfs2_osb_dump()



Commit a75e9cca ("ocfs2: use spinlock irqsave for downconvert lock")
missed an unmodified place in ocfs2_osb_dump(), so it still exists a
deadlock scenario.

    ocfs2_wake_downconvert_thread
    ocfs2_rw_unlock
    ocfs2_dio_end_io
    dio_complete
    .....
    bio_endio
    req_bio_endio
    ....
    scsi_io_completion
    blk_done_softirq
    __do_softirq
    do_softirq
    irq_exit
    do_IRQ
    ocfs2_osb_dump
    cat /sys/kernel/debug/ocfs2/${uuid}/fs_state

This patch still uses spin_lock_irqsave() - replace spin_lock() to solve
this situation.

Signed-off-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4d548f61
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -236,6 +236,7 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
	struct ocfs2_recovery_map *rm = osb->recovery_map;
	struct ocfs2_recovery_map *rm = osb->recovery_map;
	struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan;
	struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan;
	int i, out = 0;
	int i, out = 0;
	unsigned long flags;


	out += snprintf(buf + out, len - out,
	out += snprintf(buf + out, len - out,
			"%10s => Id: %-s  Uuid: %-s  Gen: 0x%X  Label: %-s\n",
			"%10s => Id: %-s  Uuid: %-s  Gen: 0x%X  Label: %-s\n",
@@ -271,14 +272,14 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
				cconn->cc_version.pv_minor);
				cconn->cc_version.pv_minor);
	}
	}


	spin_lock(&osb->dc_task_lock);
	spin_lock_irqsave(&osb->dc_task_lock, flags);
	out += snprintf(buf + out, len - out,
	out += snprintf(buf + out, len - out,
			"%10s => Pid: %d  Count: %lu  WakeSeq: %lu  "
			"%10s => Pid: %d  Count: %lu  WakeSeq: %lu  "
			"WorkSeq: %lu\n", "DownCnvt",
			"WorkSeq: %lu\n", "DownCnvt",
			(osb->dc_task ?  task_pid_nr(osb->dc_task) : -1),
			(osb->dc_task ?  task_pid_nr(osb->dc_task) : -1),
			osb->blocked_lock_count, osb->dc_wake_sequence,
			osb->blocked_lock_count, osb->dc_wake_sequence,
			osb->dc_work_sequence);
			osb->dc_work_sequence);
	spin_unlock(&osb->dc_task_lock);
	spin_unlock_irqrestore(&osb->dc_task_lock, flags);


	spin_lock(&osb->osb_lock);
	spin_lock(&osb->osb_lock);
	out += snprintf(buf + out, len - out, "%10s => Pid: %d  Nodes:",
	out += snprintf(buf + out, len - out, "%10s => Pid: %d  Nodes:",