From 0e1dfedca7487b95a6c15c800ff58b7938c51071 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 10 Feb 2021 13:29:39 -0500 Subject: [PATCH] Fixes for 4.9 Signed-off-by: Sasha Levin --- ...ents-writeback.h-fix-wstringop-trunc.patch | 191 ++++++++++++++ .../lib-string-add-strscpy_pad-function.patch | 118 +++++++++ ...h-in-wb_workfn-when-a-device-disappe.patch | 236 ++++++++++++++++++ queue-4.9/series | 3 + 4 files changed, 548 insertions(+) create mode 100644 queue-4.9/include-trace-events-writeback.h-fix-wstringop-trunc.patch create mode 100644 queue-4.9/lib-string-add-strscpy_pad-function.patch create mode 100644 queue-4.9/memcg-fix-a-crash-in-wb_workfn-when-a-device-disappe.patch diff --git a/queue-4.9/include-trace-events-writeback.h-fix-wstringop-trunc.patch b/queue-4.9/include-trace-events-writeback.h-fix-wstringop-trunc.patch new file mode 100644 index 00000000000..c267a95c062 --- /dev/null +++ b/queue-4.9/include-trace-events-writeback.h-fix-wstringop-trunc.patch @@ -0,0 +1,191 @@ +From 2391e55bdc351a70d7b803a179d7cfe82312d8e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Sep 2019 16:46:16 -0700 +Subject: include/trace/events/writeback.h: fix -Wstringop-truncation warnings + +From: Qian Cai + +[ Upstream commit d1a445d3b86c9341ce7a0954c23be0edb5c9bec5 ] + +There are many of those warnings. + +In file included from ./arch/powerpc/include/asm/paca.h:15, + from ./arch/powerpc/include/asm/current.h:13, + from ./include/linux/thread_info.h:21, + from ./include/asm-generic/preempt.h:5, + from ./arch/powerpc/include/generated/asm/preempt.h:1, + from ./include/linux/preempt.h:78, + from ./include/linux/spinlock.h:51, + from fs/fs-writeback.c:19: +In function 'strncpy', + inlined from 'perf_trace_writeback_page_template' at +./include/trace/events/writeback.h:56:1: +./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified +bound 32 equals destination size [-Wstringop-truncation] + return __builtin_strncpy(p, q, size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Fix it by using the new strscpy_pad() which was introduced in "lib/string: +Add strscpy_pad() function" and will always be NUL-terminated instead of +strncpy(). Also, change strlcpy() to use strscpy_pad() in this file for +consistency. + +Link: http://lkml.kernel.org/r/1564075099-27750-1-git-send-email-cai@lca.pw +Fixes: 455b2864686d ("writeback: Initial tracing support") +Fixes: 028c2dd184c0 ("writeback: Add tracing to balance_dirty_pages") +Fixes: e84d0a4f8e39 ("writeback: trace event writeback_queue_io") +Fixes: b48c104d2211 ("writeback: trace event bdi_dirty_ratelimit") +Fixes: cc1676d917f3 ("writeback: Move requeueing when I_SYNC set to writeback_sb_inodes()") +Fixes: 9fb0a7da0c52 ("writeback: add more tracepoints") +Signed-off-by: Qian Cai +Reviewed-by: Jan Kara +Cc: Tobin C. Harding +Cc: Steven Rostedt (VMware) +Cc: Ingo Molnar +Cc: Tejun Heo +Cc: Dave Chinner +Cc: Fengguang Wu +Cc: Jens Axboe +Cc: Joe Perches +Cc: Kees Cook +Cc: Jann Horn +Cc: Jonathan Corbet +Cc: Nitin Gote +Cc: Rasmus Villemoes +Cc: Stephen Kitt +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/trace/events/writeback.h | 38 +++++++++++++++++--------------- + 1 file changed, 20 insertions(+), 18 deletions(-) + +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h +index ec964a924cd2f..c6cea40e6e6fc 100644 +--- a/include/trace/events/writeback.h ++++ b/include/trace/events/writeback.h +@@ -65,8 +65,9 @@ TRACE_EVENT(writeback_dirty_page, + ), + + TP_fast_assign( +- strncpy(__entry->name, +- mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32); ++ strscpy_pad(__entry->name, ++ mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", ++ 32); + __entry->ino = mapping ? mapping->host->i_ino : 0; + __entry->index = page->index; + ), +@@ -95,8 +96,8 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, + struct backing_dev_info *bdi = inode_to_bdi(inode); + + /* may be called for files on pseudo FSes w/ unregistered bdi */ +- strncpy(__entry->name, +- bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); ++ strscpy_pad(__entry->name, ++ bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->flags = flags; +@@ -175,8 +176,8 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, + ), + + TP_fast_assign( +- strncpy(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ strscpy_pad(__entry->name, ++ dev_name(inode_to_bdi(inode)->dev), 32); + __entry->ino = inode->i_ino; + __entry->sync_mode = wbc->sync_mode; + __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); +@@ -219,8 +220,9 @@ DECLARE_EVENT_CLASS(writeback_work_class, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strncpy(__entry->name, +- wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32); ++ strscpy_pad(__entry->name, ++ wb->bdi->dev ? dev_name(wb->bdi->dev) : ++ "(unknown)", 32); + __entry->nr_pages = work->nr_pages; + __entry->sb_dev = work->sb ? work->sb->s_dev : 0; + __entry->sync_mode = work->sync_mode; +@@ -273,7 +275,7 @@ DECLARE_EVENT_CLASS(writeback_class, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strncpy(__entry->name, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); + __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), + TP_printk("bdi %s: cgroup_ino=%u", +@@ -296,7 +298,7 @@ TRACE_EVENT(writeback_bdi_register, + __array(char, name, 32) + ), + TP_fast_assign( +- strncpy(__entry->name, dev_name(bdi->dev), 32); ++ strscpy_pad(__entry->name, dev_name(bdi->dev), 32); + ), + TP_printk("bdi %s", + __entry->name +@@ -321,7 +323,7 @@ DECLARE_EVENT_CLASS(wbc_class, + ), + + TP_fast_assign( +- strncpy(__entry->name, dev_name(bdi->dev), 32); ++ strscpy_pad(__entry->name, dev_name(bdi->dev), 32); + __entry->nr_to_write = wbc->nr_to_write; + __entry->pages_skipped = wbc->pages_skipped; + __entry->sync_mode = wbc->sync_mode; +@@ -372,7 +374,7 @@ TRACE_EVENT(writeback_queue_io, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strncpy(__entry->name, dev_name(wb->bdi->dev), 32); ++ strncpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); + __entry->older = dirtied_before; + __entry->age = (jiffies - dirtied_before) * 1000 / HZ; + __entry->moved = moved; +@@ -457,7 +459,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, + ), + + TP_fast_assign( +- strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); + __entry->write_bw = KBps(wb->write_bandwidth); + __entry->avg_write_bw = KBps(wb->avg_write_bandwidth); + __entry->dirty_rate = KBps(dirty_rate); +@@ -522,7 +524,7 @@ TRACE_EVENT(balance_dirty_pages, + + TP_fast_assign( + unsigned long freerun = (thresh + bg_thresh) / 2; +- strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); + + __entry->limit = global_wb_domain.dirty_limit; + __entry->setpoint = (global_wb_domain.dirty_limit + +@@ -582,8 +584,8 @@ TRACE_EVENT(writeback_sb_inodes_requeue, + ), + + TP_fast_assign( +- strncpy(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ strscpy_pad(__entry->name, ++ dev_name(inode_to_bdi(inode)->dev), 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->dirtied_when = inode->dirtied_when; +@@ -656,8 +658,8 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, + ), + + TP_fast_assign( +- strncpy(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ strscpy_pad(__entry->name, ++ dev_name(inode_to_bdi(inode)->dev), 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->dirtied_when = inode->dirtied_when; +-- +2.27.0 + diff --git a/queue-4.9/lib-string-add-strscpy_pad-function.patch b/queue-4.9/lib-string-add-strscpy_pad-function.patch new file mode 100644 index 00000000000..02e8eed8d82 --- /dev/null +++ b/queue-4.9/lib-string-add-strscpy_pad-function.patch @@ -0,0 +1,118 @@ +From a4af35f2360c346404da21b572184f7007b91bd2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Apr 2019 12:58:58 +1100 +Subject: lib/string: Add strscpy_pad() function + +From: Tobin C. Harding + +[ Upstream commit 458a3bf82df4fe1f951d0f52b1e0c1e9d5a88a3b ] + +We have a function to copy strings safely and we have a function to copy +strings and zero the tail of the destination (if source string is +shorter than destination buffer) but we do not have a function to do +both at once. This means developers must write this themselves if they +desire this functionality. This is a chore, and also leaves us open to +off by one errors unnecessarily. + +Add a function that calls strscpy() then memset()s the tail to zero if +the source string is shorter than the destination buffer. + +Acked-by: Kees Cook +Signed-off-by: Tobin C. Harding +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + include/linux/string.h | 4 ++++ + lib/string.c | 47 +++++++++++++++++++++++++++++++++++------- + 2 files changed, 44 insertions(+), 7 deletions(-) + +diff --git a/include/linux/string.h b/include/linux/string.h +index 42eed573ebb63..66a91f5a34499 100644 +--- a/include/linux/string.h ++++ b/include/linux/string.h +@@ -29,6 +29,10 @@ size_t strlcpy(char *, const char *, size_t); + #ifndef __HAVE_ARCH_STRSCPY + ssize_t strscpy(char *, const char *, size_t); + #endif ++ ++/* Wraps calls to strscpy()/memset(), no arch specific code required */ ++ssize_t strscpy_pad(char *dest, const char *src, size_t count); ++ + #ifndef __HAVE_ARCH_STRCAT + extern char * strcat(char *, const char *); + #endif +diff --git a/lib/string.c b/lib/string.c +index d099762a9bd60..8fe13371aed7a 100644 +--- a/lib/string.c ++++ b/lib/string.c +@@ -157,11 +157,9 @@ EXPORT_SYMBOL(strlcpy); + * @src: Where to copy the string from + * @count: Size of destination buffer + * +- * Copy the string, or as much of it as fits, into the dest buffer. +- * The routine returns the number of characters copied (not including +- * the trailing NUL) or -E2BIG if the destination buffer wasn't big enough. +- * The behavior is undefined if the string buffers overlap. +- * The destination buffer is always NUL terminated, unless it's zero-sized. ++ * Copy the string, or as much of it as fits, into the dest buffer. The ++ * behavior is undefined if the string buffers overlap. The destination ++ * buffer is always NUL terminated, unless it's zero-sized. + * + * Preferred to strlcpy() since the API doesn't require reading memory + * from the src string beyond the specified "count" bytes, and since +@@ -171,8 +169,10 @@ EXPORT_SYMBOL(strlcpy); + * + * Preferred to strncpy() since it always returns a valid string, and + * doesn't unnecessarily force the tail of the destination buffer to be +- * zeroed. If the zeroing is desired, it's likely cleaner to use strscpy() +- * with an overflow test, then just memset() the tail of the dest buffer. ++ * zeroed. If zeroing is desired please use strscpy_pad(). ++ * ++ * Return: The number of characters copied (not including the trailing ++ * %NUL) or -E2BIG if the destination buffer wasn't big enough. + */ + ssize_t strscpy(char *dest, const char *src, size_t count) + { +@@ -259,6 +259,39 @@ char *stpcpy(char *__restrict__ dest, const char *__restrict__ src) + } + EXPORT_SYMBOL(stpcpy); + ++/** ++ * strscpy_pad() - Copy a C-string into a sized buffer ++ * @dest: Where to copy the string to ++ * @src: Where to copy the string from ++ * @count: Size of destination buffer ++ * ++ * Copy the string, or as much of it as fits, into the dest buffer. The ++ * behavior is undefined if the string buffers overlap. The destination ++ * buffer is always %NUL terminated, unless it's zero-sized. ++ * ++ * If the source string is shorter than the destination buffer, zeros ++ * the tail of the destination buffer. ++ * ++ * For full explanation of why you may want to consider using the ++ * 'strscpy' functions please see the function docstring for strscpy(). ++ * ++ * Return: The number of characters copied (not including the trailing ++ * %NUL) or -E2BIG if the destination buffer wasn't big enough. ++ */ ++ssize_t strscpy_pad(char *dest, const char *src, size_t count) ++{ ++ ssize_t written; ++ ++ written = strscpy(dest, src, count); ++ if (written < 0 || written == count - 1) ++ return written; ++ ++ memset(dest + written + 1, 0, count - written - 1); ++ ++ return written; ++} ++EXPORT_SYMBOL(strscpy_pad); ++ + #ifndef __HAVE_ARCH_STRCAT + /** + * strcat - Append one %NUL-terminated string to another +-- +2.27.0 + diff --git a/queue-4.9/memcg-fix-a-crash-in-wb_workfn-when-a-device-disappe.patch b/queue-4.9/memcg-fix-a-crash-in-wb_workfn-when-a-device-disappe.patch new file mode 100644 index 00000000000..b0f91ff6969 --- /dev/null +++ b/queue-4.9/memcg-fix-a-crash-in-wb_workfn-when-a-device-disappe.patch @@ -0,0 +1,236 @@ +From df06c1c6effbc27f580378fa477b108e309e445a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Jan 2020 22:11:04 -0800 +Subject: memcg: fix a crash in wb_workfn when a device disappears + +From: Theodore Ts'o + +[ Upstream commit 68f23b89067fdf187763e75a56087550624fdbee ] + +Without memcg, there is a one-to-one mapping between the bdi and +bdi_writeback structures. In this world, things are fairly +straightforward; the first thing bdi_unregister() does is to shutdown +the bdi_writeback structure (or wb), and part of that writeback ensures +that no other work queued against the wb, and that the wb is fully +drained. + +With memcg, however, there is a one-to-many relationship between the bdi +and bdi_writeback structures; that is, there are multiple wb objects +which can all point to a single bdi. There is a refcount which prevents +the bdi object from being released (and hence, unregistered). So in +theory, the bdi_unregister() *should* only get called once its refcount +goes to zero (bdi_put will drop the refcount, and when it is zero, +release_bdi gets called, which calls bdi_unregister). + +Unfortunately, del_gendisk() in block/gen_hd.c never got the memo about +the Brave New memcg World, and calls bdi_unregister directly. It does +this without informing the file system, or the memcg code, or anything +else. This causes the root wb associated with the bdi to be +unregistered, but none of the memcg-specific wb's are shutdown. So when +one of these wb's are woken up to do delayed work, they try to +dereference their wb->bdi->dev to fetch the device name, but +unfortunately bdi->dev is now NULL, thanks to the bdi_unregister() +called by del_gendisk(). As a result, *boom*. + +Fortunately, it looks like the rest of the writeback path is perfectly +happy with bdi->dev and bdi->owner being NULL, so the simplest fix is to +create a bdi_dev_name() function which can handle bdi->dev being NULL. +This also allows us to bulletproof the writeback tracepoints to prevent +them from dereferencing a NULL pointer and crashing the kernel if one is +tracing with memcg's enabled, and an iSCSI device dies or a USB storage +stick is pulled. + +The most common way of triggering this will be hotremoval of a device +while writeback with memcg enabled is going on. It was triggering +several times a day in a heavily loaded production environment. + +Google Bug Id: 145475544 + +Link: https://lore.kernel.org/r/20191227194829.150110-1-tytso@mit.edu +Link: http://lkml.kernel.org/r/20191228005211.163952-1-tytso@mit.edu +Signed-off-by: Theodore Ts'o +Cc: Chris Mason +Cc: Tejun Heo +Cc: Jens Axboe +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + fs/fs-writeback.c | 2 +- + include/linux/backing-dev.h | 10 ++++++++++ + include/trace/events/writeback.h | 29 +++++++++++++---------------- + mm/backing-dev.c | 1 + + 4 files changed, 25 insertions(+), 17 deletions(-) + +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c +index f978ae2bb846f..2de656ecc48bb 100644 +--- a/fs/fs-writeback.c ++++ b/fs/fs-writeback.c +@@ -1971,7 +1971,7 @@ void wb_workfn(struct work_struct *work) + struct bdi_writeback, dwork); + long pages_written; + +- set_worker_desc("flush-%s", dev_name(wb->bdi->dev)); ++ set_worker_desc("flush-%s", bdi_dev_name(wb->bdi)); + current->flags |= PF_SWAPWRITE; + + if (likely(!current_is_workqueue_rescuer() || +diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h +index 63f17b106a4a6..57db558c9a616 100644 +--- a/include/linux/backing-dev.h ++++ b/include/linux/backing-dev.h +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -517,4 +518,13 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) + (1 << WB_async_congested)); + } + ++extern const char *bdi_unknown_name; ++ ++static inline const char *bdi_dev_name(struct backing_dev_info *bdi) ++{ ++ if (!bdi || !bdi->dev) ++ return bdi_unknown_name; ++ return dev_name(bdi->dev); ++} ++ + #endif /* _LINUX_BACKING_DEV_H */ +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h +index c6cea40e6e6fc..49a72adc7135c 100644 +--- a/include/trace/events/writeback.h ++++ b/include/trace/events/writeback.h +@@ -66,8 +66,8 @@ TRACE_EVENT(writeback_dirty_page, + + TP_fast_assign( + strscpy_pad(__entry->name, +- mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", +- 32); ++ bdi_dev_name(mapping ? inode_to_bdi(mapping->host) : ++ NULL), 32); + __entry->ino = mapping ? mapping->host->i_ino : 0; + __entry->index = page->index; + ), +@@ -96,8 +96,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, + struct backing_dev_info *bdi = inode_to_bdi(inode); + + /* may be called for files on pseudo FSes w/ unregistered bdi */ +- strscpy_pad(__entry->name, +- bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); ++ strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->flags = flags; +@@ -177,7 +176,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, + + TP_fast_assign( + strscpy_pad(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ bdi_dev_name(inode_to_bdi(inode)), 32); + __entry->ino = inode->i_ino; + __entry->sync_mode = wbc->sync_mode; + __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); +@@ -220,9 +219,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strscpy_pad(__entry->name, +- wb->bdi->dev ? dev_name(wb->bdi->dev) : +- "(unknown)", 32); ++ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); + __entry->nr_pages = work->nr_pages; + __entry->sb_dev = work->sb ? work->sb->s_dev : 0; + __entry->sync_mode = work->sync_mode; +@@ -275,7 +272,7 @@ DECLARE_EVENT_CLASS(writeback_class, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strscpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); + __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); + ), + TP_printk("bdi %s: cgroup_ino=%u", +@@ -298,7 +295,7 @@ TRACE_EVENT(writeback_bdi_register, + __array(char, name, 32) + ), + TP_fast_assign( +- strscpy_pad(__entry->name, dev_name(bdi->dev), 32); ++ strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); + ), + TP_printk("bdi %s", + __entry->name +@@ -323,7 +320,7 @@ DECLARE_EVENT_CLASS(wbc_class, + ), + + TP_fast_assign( +- strscpy_pad(__entry->name, dev_name(bdi->dev), 32); ++ strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); + __entry->nr_to_write = wbc->nr_to_write; + __entry->pages_skipped = wbc->pages_skipped; + __entry->sync_mode = wbc->sync_mode; +@@ -374,7 +371,7 @@ TRACE_EVENT(writeback_queue_io, + __field(unsigned int, cgroup_ino) + ), + TP_fast_assign( +- strncpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); + __entry->older = dirtied_before; + __entry->age = (jiffies - dirtied_before) * 1000 / HZ; + __entry->moved = moved; +@@ -459,7 +456,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, + ), + + TP_fast_assign( +- strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32); + __entry->write_bw = KBps(wb->write_bandwidth); + __entry->avg_write_bw = KBps(wb->avg_write_bandwidth); + __entry->dirty_rate = KBps(dirty_rate); +@@ -524,7 +521,7 @@ TRACE_EVENT(balance_dirty_pages, + + TP_fast_assign( + unsigned long freerun = (thresh + bg_thresh) / 2; +- strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); ++ strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32); + + __entry->limit = global_wb_domain.dirty_limit; + __entry->setpoint = (global_wb_domain.dirty_limit + +@@ -585,7 +582,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, + + TP_fast_assign( + strscpy_pad(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ bdi_dev_name(inode_to_bdi(inode)), 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->dirtied_when = inode->dirtied_when; +@@ -659,7 +656,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, + + TP_fast_assign( + strscpy_pad(__entry->name, +- dev_name(inode_to_bdi(inode)->dev), 32); ++ bdi_dev_name(inode_to_bdi(inode)), 32); + __entry->ino = inode->i_ino; + __entry->state = inode->i_state; + __entry->dirtied_when = inode->dirtied_when; +diff --git a/mm/backing-dev.c b/mm/backing-dev.c +index 113b7d3170799..aad61d0175a1c 100644 +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -21,6 +21,7 @@ struct backing_dev_info noop_backing_dev_info = { + EXPORT_SYMBOL_GPL(noop_backing_dev_info); + + static struct class *bdi_class; ++const char *bdi_unknown_name = "(unknown)"; + + /* + * bdi_lock protects updates to bdi_list. bdi_list has RCU reader side +-- +2.27.0 + diff --git a/queue-4.9/series b/queue-4.9/series index e561bc6a23b..602e324f09a 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -7,3 +7,6 @@ iwlwifi-pcie-add-a-null-check-in-iwl_pcie_txq_unmap.patch iwlwifi-mvm-guard-against-device-removal-in-reprobe.patch sunrpc-move-simple_get_bytes-and-simple_get_netobj-i.patch sunrpc-handle-0-length-opaque-xdr-object-data-proper.patch +lib-string-add-strscpy_pad-function.patch +include-trace-events-writeback.h-fix-wstringop-trunc.patch +memcg-fix-a-crash-in-wb_workfn-when-a-device-disappe.patch -- 2.47.2