Skip to content

Commit aec14f4

Browse files
Wu Fengguanggregkh
authored andcommitted
writeback: fix NULL bdi->dev in trace writeback_single_inode
commit 15eb77a upstream. 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. Reported-by: Rabin Vincent <rabin@rab.in> Tested-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 60d08dd commit aec14f4

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎fs/fs-writeback.c‎

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

50-
/*
51-
* Include the creation of the trace points after defining the
52-
* wb_writeback_work structure so that the definition remains local to this
53-
* file.
54-
*/
55-
#define CREATE_TRACE_POINTS
56-
#include <trace/events/writeback.h>
57-
5850
/*
5951
* We don't actually have pdflush, but this one is exported though /proc...
6052
*/
@@ -87,6 +79,14 @@ static inline struct inode *wb_inode(struct list_head *head)
8779
return list_entry(head, struct inode, i_wb_list);
8880
}
8981

82+
/*
83+
* Include the creation of the trace points after defining the
84+
* wb_writeback_work structure and inline functions so that the definition
85+
* remains local to this file.
86+
*/
87+
#define CREATE_TRACE_POINTS
88+
#include <trace/events/writeback.h>
89+
9090
/* Wakeup flusher thread or forker thread to fork it. Requires bdi->wb_lock. */
9191
static void bdi_wakeup_flusher(struct backing_dev_info *bdi)
9292
{

‎include/trace/events/writeback.h‎

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

419419
TP_fast_assign(
420420
strncpy(__entry->name,
421-
dev_name(inode->i_mapping->backing_dev_info->dev), 32);
421+
dev_name(inode_to_bdi(inode)->dev), 32);
422422
__entry->ino = inode->i_ino;
423423
__entry->state = inode->i_state;
424424
__entry->dirtied_when = inode->dirtied_when;

0 commit comments

Comments
 (0)