LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: swsusp: fix devfs breakage introduced in 2.6.6
@ 2004-05-21 18:05 Sau Dan Lee
2004-05-21 18:44 ` Valdis.Kletnieks
0 siblings, 1 reply; 3+ messages in thread
From: Sau Dan Lee @ 2004-05-21 18:05 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
>>>>> "Pavel" == Pavel Machek <pavel@ucw.cz> writes:
Pavel> Hi! This fixes bad interaction between devfs and swsusp.
Pavel> Check whether the swap device is the specified resume
Pavel> device, irrespective of whether they are specified by
Pavel> identical names.
Pavel> (Thus, device inode aliasing is allowed. You can say
Pavel> /dev/hda4 instead of /dev/ide/host0/bus0/target0/lun0/part4
Pavel> [if using devfs] and they'll be considered the same device.
Pavel> This is *necessary* for devfs, since the resume code can
Pavel> only recognize the form /dev/hda4, but the suspend code
Pavel> would like the long name [as shown in 'cat /proc/mounts'].)
Pavel> [Thanks to devfs hero whose name I forgot.] Pavel
The patch was submitted by me. But I'm no devfs hero at all. I'm
just a happy user of devfs who gets unhappy due to this swsusp bug.
:)
--
Sau Dan LEE 李守敦(Big5) ~{@nJX6X~}(HZ)
E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: swsusp: fix devfs breakage introduced in 2.6.6
2004-05-21 18:05 swsusp: fix devfs breakage introduced in 2.6.6 Sau Dan Lee
@ 2004-05-21 18:44 ` Valdis.Kletnieks
0 siblings, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks @ 2004-05-21 18:44 UTC (permalink / raw)
To: Sau Dan Lee; +Cc: Pavel Machek, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]
On Fri, 21 May 2004 20:05:01 +0200, Sau Dan Lee said:
> The patch was submitted by me. But I'm no devfs hero at all. I'm
> just a happy user of devfs who gets unhappy due to this swsusp bug.
> :)
Congratulate yourself anyhow. It's that type of hero that makes Linux (or open
source in general, for that matter) work as well as it does. Yes, there's a
core crew of several dozen maintainers (who all deserve our thanks too), but
they can't develop a great operating system in a vacuum - without good bug
reports and the occasional user-provided patch, it all grinds to a halt very
quickly....
(OK, *everybody* who's ever contributed, take a bow now. :)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* swsusp: fix devfs breakage introduced in 2.6.6
@ 2004-05-21 11:05 Pavel Machek
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2004-05-21 11:05 UTC (permalink / raw)
To: kernel list, Andrew Morton
Hi!
This fixes bad interaction between devfs and swsusp.
Check whether the swap device is the specified resume
device, irrespective of whether they are specified by
identical names.
(Thus, device inode aliasing is allowed. You can say
/dev/hda4 instead of /dev/ide/host0/bus0/target0/lun0/part4
[if using devfs] and they'll be considered the same device.
This is *necessary* for devfs, since the resume code can
only recognize the form /dev/hda4, but the suspend code
would like the long name [as shown in 'cat /proc/mounts'].)
[Thanks to devfs hero whose name I forgot.]
Pavel
--- clean/kernel/power/swsusp.c 2004-05-20 23:08:36.000000000 +0200
+++ linux/kernel/power/swsusp.c 2004-05-21 12:26:43.000000000 +0200
@@ -222,10 +224,30 @@
__free_page(page);
}
+
+/*
+ * Check whether the swap device is the specified resume
+ * device, irrespective of whether they are specified by
+ * identical names.
+ *
+ * (Thus, device inode aliasing is allowed. You can say /dev/hda4
+ * instead of /dev/ide/host0/bus0/target0/lun0/part4 [if using devfs]
+ * and they'll be considered the same device. This is *necessary* for
+ * devfs, since the resume code can only recognize the form /dev/hda4,
+ * but the suspend code would see the long name.)
+ */
+static int is_resume_device(const struct swap_info_struct *swap_info)
+{
+ struct file *file = swap_info->swap_file;
+ struct inode *inode = file->f_dentry->d_inode;
+
+ return S_ISBLK(inode->i_mode) &&
+ resume_device == MKDEV(imajor(inode), iminor(inode));
+}
+
static void read_swapfiles(void) /* This is called before saving image */
{
int i, len;
- static char buff[sizeof(resume_file)], *sname;
len=strlen(resume_file);
root_swap = 0xFFFF;
@@ -244,17 +266,10 @@
swapfile_used[i] = SWAPFILE_IGNORED;
} else {
/* we ignore all swap devices that are not the resume_file */
- sname = d_path(swap_info[i].swap_file->f_dentry,
- swap_info[i].swap_file->f_vfsmnt,
- buff,
- sizeof(buff));
- if (!strcmp(sname, resume_file)) {
+ if (is_resume_device(&swap_info[i])) {
swapfile_used[i] = SWAPFILE_SUSPEND;
root_swap = i;
} else {
-#if 0
- printk( "Resume: device %s (%x != %x) ignored\n", swap_info[i].swap_file->d_name.name, swap_info[i].swap_device, resume_device );
-#endif
swapfile_used[i] = SWAPFILE_IGNORED;
}
}
--
934a471f20d6580d5aad759bf0d97ddc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-21 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 18:05 swsusp: fix devfs breakage introduced in 2.6.6 Sau Dan Lee
2004-05-21 18:44 ` Valdis.Kletnieks
-- strict thread matches above, loose matches on Subject: below --
2004-05-21 11:05 Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).