From: Wu Fengguang Date: Tue, 17 Jan 2012 17:18:56 +0000 (-0600) Subject: writeback: fix NULL bdi->dev in trace writeback_single_inode X-Git-Tag: v3.2.7~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aec14f459cc9d40f9fd4a7aad2be761de084b320;p=people%2Fms%2Flinux.git writeback: fix NULL bdi->dev in trace writeback_single_inode commit 15eb77a07c714ac80201abd0a9568888bcee6276 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 Tested-by: Rabin Vincent Signed-off-by: Wu Fengguang Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 517f211a3bd4..54f578684496 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -47,14 +47,6 @@ struct wb_writeback_work { struct completion *done; /* set if the caller waits */ }; -/* - * Include the creation of the trace points after defining the - * wb_writeback_work structure so that the definition remains local to this - * file. - */ -#define CREATE_TRACE_POINTS -#include - /* * We don't actually have pdflush, but this one is exported though /proc... */ @@ -87,6 +79,14 @@ static inline struct inode *wb_inode(struct list_head *head) return list_entry(head, struct inode, i_wb_list); } +/* + * Include the creation of the trace points after defining the + * wb_writeback_work structure and inline functions so that the definition + * remains local to this file. + */ +#define CREATE_TRACE_POINTS +#include + /* Wakeup flusher thread or forker thread to fork it. Requires bdi->wb_lock. */ static void bdi_wakeup_flusher(struct backing_dev_info *bdi) { diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 99d1d0decf88..46e389cf3063 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -418,7 +418,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, TP_fast_assign( strncpy(__entry->name, - dev_name(inode->i_mapping->backing_dev_info->dev), 32); + dev_name(inode_to_bdi(inode)->dev), 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; __entry->dirtied_when = inode->dirtied_when;