Re: BUG while suspending to swap on LVM

Rafael J. Wysocki
2006-08-14T19:16:26Z

On Monday 14 August 2006 19:48, Laurent Riffard wrote:
>
> Le 14.08.2006 19:30, Rafael J. Wysocki a écrit :
> > Hi,
> >
> > Thanks for the report.
> >
> > On Monday 14 August 2006 18:49, Laurent Riffard wrote:
> >> Hello,
> >>
> >> I hit a BUG while I was trying to suspend to a swap device on LVM.
> >> The call trace looks like this (see attached picture for detailed
> >> stack trace):
> >>
> >> EIP is at _raw_spin_lock
> >> Call Trace:
> >> die
> >> do_page_fault
> >> error_code
> >> _spin_lock_irq
> >> generic_unplug_device
> >> wait_on_bio_chain
> >> swap_write_image
> >
> > This should be swap_write_page().
>
> right.
>
> >> swsusp_write
> >> pm_suspend_disk
> >> enter_state
> >> state_store
> >> susbsys_attr_store
> >> sysfs_write_file
> >> vfs_write
> >> sys_write
> >> sysenter_past_esp
> >>
> >> It was Linux 2.6.18-rc4-mm1 booted with:
> >> root=/dev/vglinux1/lvroot video=vesafb:mtrr splash=silent resume=/dev/mapper/vglinux1-lvswap init 1
> >
> > Does the unpatched 2.6.18-rc4 work in this configuration?
>
> Will try.

Well, I'm afraid it won't work.

Can you please try the appended patch?

Rafael

---
mm/swapfile.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.18-rc4-mm1/mm/swapfile.c
===================================================================
--- linux-2.6.18-rc4-mm1.orig/mm/swapfile.c 2006-08-13 14:54:43.000000000 +0200
+++ linux-2.6.18-rc4-mm1/mm/swapfile.c 2006-08-14 21:09:09.000000000 +0200
@@ -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);