swsusp: Fix swap_type_of
Subsystems (2)
PATCH 1/1 swsusp: Fix swap_type_of
There is a bug in mm/swapfile.c#swap_type_of() that makes swsusp only be able to use the first active swap partition as the resume device. Fix it.
--- mm/swapfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/swapfile.c +2 -1
@@ -442,11 +442,12 @@ int swap_type_of(dev_t device)if (!(swap_info[i].flags &SWP_WRITEOK ))continue ; +if (!device) {spin_unlock (&swap_lock);return i; } - inode = swap_info->swap_file->f_dentry->d_inode; + inode = swap_info[i].swap_file->f_dentry->d_inode;if (S_ISBLK (inode->i_mode) && device ==MKDEV (imajor (inode),iminor (inode))) {spin_unlock (&swap_lock);
Quoted 3 lines · Rafael J. Wysocki
There is a bug in mm/swapfile.c#swap_type_of() that makes swsusp only be able to use the first active swap partition as the resume device. Fix it.
ACK. (And I guess this is 2.6.18 material, right? Or is that fix not needed in mainline?)
Pavel
Quoted 18 lines
Index:
linux-2.6.18-rc4-mm1/mm/swapfile.c
===================================================================mm/swapfile.c +2
-1@@ -442,11 +442,12 @@ int swap_type_of(dev_t device)if (!(swap_info[i].flags &SWP_WRITEOK ))continue ; +if (!device) {spin_unlock (&swap_lock);return i; } - inode = swap_info->swap_file->f_dentry->d_inode; + inode = swap_info[i].swap_file->f_dentry->d_inode;if (S_ISBLK (inode->i_mode) && device ==MKDEV (imajor (inode),iminor (inode))) {spin_unlock (&swap_lock);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Pavel Machek
Quoted 3 lines · Rafael J. Wysocki
There is a bug in mm/swapfile.c#swap_type_of() that makes swsusp only be able to use the first active swap partition as the resume device. Fix it.
ACK. (And I guess this is 2.6.18 material, right? Or is that fix not needed in mainline?)
Oh, yes I think it is needed. 2.6.18 material, surely.
Rafael
Signature · 2 lines
You never change things by fighting the existing reality. R. Buckminster Fuller
Quoted 7 lines · Pavel Machek
Quoted 3 lines · Rafael J. Wysocki
There is a bug in mm/swapfile.c#swap_type_of() that makes swsusp only be able to use the first active swap partition as the resume device. Fix it.
ACK. (And I guess this is 2.6.18 material, right? Or is that fix not needed in mainline?)
This fixed an oops on suspend to disk. Definitely 2.6.18 material.
Tony