Skip to content

Commit 15eb77a

Browse files
author
Wu Fengguang
committed
writeback: fix NULL bdi->dev in trace writeback_single_inode
bdi_prune_sb() resets sb->s_bdi to default_backing_dev_info when the tearing down the original bdi. Fix trace_writeback_single_inode to use sb->s_bdi=default_backing_dev_info rather than bdi->dev=NULL for a teared down bdi. Cc: <stable@kernel.org> Reported-by: Rabin Vincent <rabin@rab.in> Tested-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
1 parent 2673b4c commit 15eb77a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

fs/fs-writeback.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ struct wb_writeback_work {
5252
struct completion *done; /* set if the caller waits */
5353
};
5454

55-
/*
56-
* Include the creation of the trace points after defining the
57-
* wb_writeback_work structure so that the definition remains local to this
58-
* file.
59-
*/
60-
#define CREATE_TRACE_POINTS
61-
#include <trace/events/writeback.h>
62-
6355
/*
6456
* We don't actually have pdflush, but this one is exported though /proc...
6557
*/
@@ -92,6 +84,14 @@ static inline struct inode *wb_inode(struct list_head *head)
9284
return list_entry(head, struct inode, i_wb_list);
9385
}
9486

87+
/*
88+
* Include the creation of the trace points after defining the
89+
* wb_writeback_work structure and inline functions so that the definition
90+
* remains local to this file.
91+
*/
92+
#define CREATE_TRACE_POINTS
93+
#include <trace/events/writeback.h>
94+
9595
/* Wakeup flusher thread or forker thread to fork it. Requires bdi->wb_lock. */
9696
static void bdi_wakeup_flusher(struct backing_dev_info *bdi)
9797
{

include/trace/events/writeback.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template,
426426

427427
TP_fast_assign(
428428
strncpy(__entry->name,
429-
dev_name(inode->i_mapping->backing_dev_info->dev), 32);
429+
dev_name(inode_to_bdi(inode)->dev), 32);
430430
__entry->ino = inode->i_ino;
431431
__entry->state = inode->i_state;
432432
__entry->dirtied_when = inode->dirtied_when;

0 commit comments

Comments
 (0)