Commit 612e1110 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Add gfp flags param to bch2_prt_task_backtrace()

Fixes: e6a2566f ("bcachefs: Better journal tracepoints")
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
Reported-by: smatch
parent 6613476e
...@@ -92,7 +92,7 @@ static noinline void print_cycle(struct printbuf *out, struct lock_graph *g) ...@@ -92,7 +92,7 @@ static noinline void print_cycle(struct printbuf *out, struct lock_graph *g)
continue; continue;
bch2_btree_trans_to_text(out, i->trans); bch2_btree_trans_to_text(out, i->trans);
bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1); bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1, GFP_NOWAIT);
} }
} }
...@@ -227,7 +227,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle) ...@@ -227,7 +227,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle)
prt_printf(&buf, "backtrace:"); prt_printf(&buf, "backtrace:");
prt_newline(&buf); prt_newline(&buf);
printbuf_indent_add(&buf, 2); printbuf_indent_add(&buf, 2);
bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2); bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2, GFP_NOWAIT);
printbuf_indent_sub(&buf, 2); printbuf_indent_sub(&buf, 2);
prt_newline(&buf); prt_newline(&buf);
} }
......
...@@ -627,7 +627,7 @@ static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf, ...@@ -627,7 +627,7 @@ static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf,
prt_printf(&i->buf, "backtrace:"); prt_printf(&i->buf, "backtrace:");
prt_newline(&i->buf); prt_newline(&i->buf);
printbuf_indent_add(&i->buf, 2); printbuf_indent_add(&i->buf, 2);
bch2_prt_task_backtrace(&i->buf, task, 0); bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL);
printbuf_indent_sub(&i->buf, 2); printbuf_indent_sub(&i->buf, 2);
prt_newline(&i->buf); prt_newline(&i->buf);
......
...@@ -233,7 +233,7 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val, bool t ...@@ -233,7 +233,7 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val, bool t
prt_str(&pbuf, "entry size: "); prt_str(&pbuf, "entry size: ");
prt_human_readable_u64(&pbuf, vstruct_bytes(buf->data)); prt_human_readable_u64(&pbuf, vstruct_bytes(buf->data));
prt_newline(&pbuf); prt_newline(&pbuf);
bch2_prt_task_backtrace(&pbuf, current, 1); bch2_prt_task_backtrace(&pbuf, current, 1, GFP_NOWAIT);
trace_journal_entry_close(c, pbuf.buf); trace_journal_entry_close(c, pbuf.buf);
printbuf_exit(&pbuf); printbuf_exit(&pbuf);
} }
......
...@@ -272,14 +272,14 @@ void bch2_print_string_as_lines(const char *prefix, const char *lines) ...@@ -272,14 +272,14 @@ void bch2_print_string_as_lines(const char *prefix, const char *lines)
console_unlock(); console_unlock();
} }
int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr) int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr,
gfp_t gfp)
{ {
#ifdef CONFIG_STACKTRACE #ifdef CONFIG_STACKTRACE
unsigned nr_entries = 0; unsigned nr_entries = 0;
int ret = 0;
stack->nr = 0; stack->nr = 0;
ret = darray_make_room(stack, 32); int ret = darray_make_room_gfp(stack, 32, gfp);
if (ret) if (ret)
return ret; return ret;
...@@ -308,10 +308,10 @@ void bch2_prt_backtrace(struct printbuf *out, bch_stacktrace *stack) ...@@ -308,10 +308,10 @@ void bch2_prt_backtrace(struct printbuf *out, bch_stacktrace *stack)
} }
} }
int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr) int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr, gfp_t gfp)
{ {
bch_stacktrace stack = { 0 }; bch_stacktrace stack = { 0 };
int ret = bch2_save_backtrace(&stack, task, skipnr + 1); int ret = bch2_save_backtrace(&stack, task, skipnr + 1, gfp);
bch2_prt_backtrace(out, &stack); bch2_prt_backtrace(out, &stack);
darray_exit(&stack); darray_exit(&stack);
......
...@@ -348,9 +348,9 @@ void bch2_prt_u64_base2(struct printbuf *, u64); ...@@ -348,9 +348,9 @@ void bch2_prt_u64_base2(struct printbuf *, u64);
void bch2_print_string_as_lines(const char *prefix, const char *lines); void bch2_print_string_as_lines(const char *prefix, const char *lines);
typedef DARRAY(unsigned long) bch_stacktrace; typedef DARRAY(unsigned long) bch_stacktrace;
int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned); int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned, gfp_t);
void bch2_prt_backtrace(struct printbuf *, bch_stacktrace *); void bch2_prt_backtrace(struct printbuf *, bch_stacktrace *);
int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned); int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned, gfp_t);
static inline void prt_bdevname(struct printbuf *out, struct block_device *bdev) static inline void prt_bdevname(struct printbuf *out, struct block_device *bdev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment