From: Rafael J. Wysocki Date: Wed, 16 Aug 2006 00:19:24 +0000 (-0700) Subject: swsusp: Fix swap_type_of X-Git-Tag: v2.6.17.11~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49071b9f45d2483dbde395fd6aa11f53974e7665;p=thirdparty%2Fkernel%2Fstable.git 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. Signed-off-by: Rafael J. Wysocki Cc: Hugh Dickins Acked-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/swapfile.c b/mm/swapfile.c index e5fd5385f0cc1..5a7760f176b90 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -440,11 +440,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);