Deadlock might be caused by allocating memory with GFP_KERNEL in
runtime_resume callback of network devices in iSCSI situation, so
mark network devices and its ancestor as 'memalloc_noio_resume'
with the introduced pm_runtime_set_memalloc_noio().

Cc: "David S. Miller" <da...@davemloft.net>
Cc: Eric Dumazet <eric.duma...@gmail.com>
Cc: David Decotigny <david.decoti...@google.com>
Cc: Tom Herbert <therb...@google.com>
Cc: Ingo Molnar <mi...@elte.hu>
Signed-off-by: Ming Lei <ming....@canonical.com>
---
 net/core/net-sysfs.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index bcf02f6..9aba5be 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -22,6 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/export.h>
 #include <linux/jiffies.h>
+#include <linux/pm_runtime.h>
 #include <net/wext.h>
 
 #include "net-sysfs.h"
@@ -1386,6 +1387,8 @@ void netdev_unregister_kobject(struct net_device * net)
 
        remove_queue_kobjects(net);
 
+       pm_runtime_set_memalloc_noio(dev, false);
+
        device_del(dev);
 }
 
@@ -1411,6 +1414,8 @@ int netdev_register_kobject(struct net_device *net)
        *groups++ = &netstat_group;
 #endif /* CONFIG_SYSFS */
 
+       pm_runtime_set_memalloc_noio(dev, true);
+
        error = device_add(dev);
        if (error)
                return error;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to