Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356556
b: refs/heads/master
c: db88175
h: refs/heads/master
v: v3
  • Loading branch information
Ming Lei authored and Linus Torvalds committed Feb 24, 2013
1 parent f645f6c commit 2da70cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9802c8e22f6efd372e83d9d5d5ff43f3562cfe19
refs/heads/master: db88175f41a29c1ffff1a6938a7969d206a47326
19 changes: 18 additions & 1 deletion trunk/drivers/base/power/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,24 @@ static int rpm_callback(int (*cb)(struct device *), struct device *dev)
if (!cb)
return -ENOSYS;

retval = __rpm_callback(cb, dev);
if (dev->power.memalloc_noio) {
unsigned int noio_flag;

/*
* Deadlock might be caused if memory allocation with
* GFP_KERNEL happens inside runtime_suspend and
* runtime_resume callbacks of one block device's
* ancestor or the block device itself. Network
* device might be thought as part of iSCSI block
* device, so network device and its ancestor should
* be marked as memalloc_noio too.
*/
noio_flag = memalloc_noio_save();
retval = __rpm_callback(cb, dev);
memalloc_noio_restore(noio_flag);
} else {
retval = __rpm_callback(cb, dev);
}

dev->power.runtime_error = retval;
return retval != -EACCES ? retval : -EIO;
Expand Down

0 comments on commit 2da70cd

Please sign in to comment.