From: Rafael J. Wysocki Date: Sun, 27 Aug 2006 08:23:25 +0000 (-0700) Subject: [PATCH] swsusp: Fix swap_type_of X-Git-Tag: MMI-PSA29.97-13-9~47824 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b6b5bce3571e496504a89ee575d32101e0a98b93;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [PATCH] 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 Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/swapfile.c b/mm/swapfile.c index e70d6c6d6fee..f1f5ec783781 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -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);