swsusp: move resume before mounting root [diff against vanilla 2.4.9]
Hi!
This is my latest version of swsusp relative to linus' 2.4.9, just in case someone wants to try it... It should now be compatible with reiserfs.
Note: it does rather ugly trick with signals (all recent versions do). That will need to be fixed, somehow.
Pavel
Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected]
Hi!
Quoted 4 lines
Solution for the filesystem problems:
1. at suspend, basically unmount the filesystem (keep the mount tree)
2. at resume, re-validate open files
Wrong solution. ;-).
Solution to filesystem problems: at suspend, sync but don't do anything more. At resume, don't try to mount anything (so that you don't replay transactions or damage disk in any other way).
Pavel
Signature · 2 lines
Causalities in World Trade Center: 6453 dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
Quoted 4 lines · Pavel Machek
[Albert Cahalan]
Quoted 2 lines
Solution for the filesystem problems:
Quoted 8 lines
Quoted 2 lines
1. at suspend, basically unmount the filesystem (keep the mount tree)
2. at resume, re-validate open filesWrong solution. ;-).
Solution to filesystem problems: at suspend, sync but don't do anything more. At resume, don't try to mount anything (so that you don't replay transactions or damage disk in any other way).
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
resume before mounting root [diff against vanilla 2.4.9]
Quoted 27 lines · Albert D. Cahalan
Quoted 4 lines · Pavel Machek
[Albert Cahalan]
Quoted 2 lines
Solution for the filesystem problems:
Quoted 8 lines
Quoted 2 lines
1. at suspend, basically unmount the filesystem (keep the mount tree)
2. at resume, re-validate open filesWrong solution. ;-).
Solution to filesystem problems: at suspend, sync but don't do anything more. At resume, don't try to mount anything (so that you don't replay transactions or damage disk in any other way).
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5
Quoted 4 lines
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
I missed the rest of the thread, but if you are talking about what I think you are talking about, I'll go <AOL>Me too</AOL>
A horrible combination of accidents with scripts that set lilo to boot to the hibernated partition if last suspended, and an apparent BIOS bug that allowed me to boot out of a hibernated partition for a second time meant that my laptop came out of regular hibernation mode (as opposed to using swsusp for "hibernation") 2 months
after I originally suspended the machine. After I had gone through numerous kernel upgrades and reboots, and after I had partially repartioned the drive. Needless to say, there were a number of partitions that were toast after this issue. Fortunately, I had made a backup of my drive (including me thesis!) only a week beforehand, and /home was fine. Not bad concidering the last backup was from 3 months ago!
Signature · 4 lines
TimC -- http://www.physics.usyd.edu.au/~tcon/ This is a dirty hack! It might burn your PC and kill your cat! -- mpg123.c source
Re: resume before mounting root [diff against vanilla 2.4.9]
In reply to Albert D. CahalanHi!
Quoted 18 lines
Quoted 13 lines
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5Quoted 4 lines
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
Quoted 7 lines
I missed the rest of the thread, but if you are talking about what I think you are talking about, I'll go <AOL>Me too</AOL>
A horrible combination of accidents with scripts that set lilo to boot to the hibernated partition if last suspended, and an apparent BIOS bug that allowed me to boot out of a hibernated partition for a second time meant that my laptop came out of regular hibernation mode (as
swsusp code will not allow you to restore from one partition twice.
Pavel
Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected]
Quoted 13 lines · Albert D. Cahalan
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5
Quoted 4 lines
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
This is possible with the "write_super_lockfs" interface to the journaling filesystems (ext3/reiserfs/XFS). This is normally used for LVM snapshots, but it could also be used for this.
Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
Hi!
Quoted 24 lines
Quoted 10 lines
Quoted 4 lines
Solution for the filesystem problems:
1. at suspend, basically unmount the filesystem (keep the mount tree)
2. at resume, re-validate open filesWrong solution. ;-).
Solution to filesystem problems: at suspend, sync but don't do anything more. At resume, don't try to mount anything (so that you don't replay transactions or damage disk in any other way).
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5
Quoted 2 lines
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones
I can't do that: open deleted files.
Quoted 2 lines
NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
No, you don't want to do that. This is swsusp package, meant to replace suspend-to-disk on your notebook. If you choose random notebook, it will allow you to suspend to disk, but not to suspend, boot X, poweron, boot Y, reboot, boot X.
If you do what you described, you'll corrupt your filesystem. It is designed that way.
Pavel
Signature · 2 lines
Casualities in World Trade Center: 6453 dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
Quoted 24 lines · Pavel Machek
Quoted 24 lines
Quoted 10 lines
Quoted 4 lines
Solution for the filesystem problems:
1. at suspend, basically unmount the filesystem (keep the mount tree)
2. at resume, re-validate open filesWrong solution. ;-).
Solution to filesystem problems: at suspend, sync but don't do anything more. At resume, don't try to mount anything (so that you don't replay transactions or damage disk in any other way).
That is totally broken, because I may mount the disk in between the suspend and resume. I might even:
1. boot kernel X
2. suspend kernel X
3. boot kernel Y
4. suspend kernel Y
5. resume kernel X
6. suspend kernel X
7. resume kernel Y
8. suspend kernel Y
9. goto #5
Quoted 4 lines
Quoted 2 lines
You really have to close the logs and mark the disks clean when you suspend. The problems here are similar the the ones
I can't do that: open deleted files.
Tough luck. Either use the same hack as NFS, or have such files return -EIO for all operations and give SIGBUS for mappings. Maybe just refuse to suspend when there are open deleted files. Oh, just create a name in the filesystem root and use that. Something like ".8fe4a979.swsusp" would be fine. Whatever!
Quoted 10 lines
Quoted 2 lines
NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
No, you don't want to do that. This is swsusp package, meant to replace suspend-to-disk on your notebook. If you choose random notebook, it will allow you to suspend to disk, but not to suspend, boot X, poweron, boot Y, reboot, boot X.
If you do what you described, you'll corrupt your filesystem. It is designed that way.
Not "If", but "When". Somebody has already posted a report of doing exactly that, by accident, with a 3-month-old suspension. The filesystems were destroyed.
Right now, swsusp is a serious hazard.
Hi!
Quoted 7 lines
Quoted 1 line
I can't do that: open deleted files.
Tough luck. Either use the same hack as NFS, or have such files return
-EIOfor all operations and give SIGBUS for mappings. Maybe just refuse to suspend when there are open deleted files. Oh, just create a name in the filesystem root and use that. Something like ".8fe4a979.swsusp" would be fine. Whatever!
...and break locking and similar stuff. NFS is not as good as local filesystem.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
NFS faces. Between the suspend and resume, filesystems may be modified in arbitrary ways.
No, you don't want to do that. This is swsusp package, meant to replace suspend-to-disk on your notebook. If you choose random notebook, it will allow you to suspend to disk, but not to suspend, boot X, poweron, boot Y, reboot, boot X.
Quoted 8 lines
Quoted 2 lines
If you do what you described, you'll corrupt your filesystem. It is designed that way.
Not "If", but "When". Somebody has already posted a report of doing exactly that, by accident, with a 3-month-old suspension. The filesystems were destroyed.
Right now, swsusp is a serious hazard.
That's why its called experimental ;-).
Currently we have "SWSUSP" signature, SWAP-FILE gets replaced with SWSUSP on suspend, and SWAP-FILE is written back on resume. That way, you can not resume two times from one image.
Additional safety measure could be added: on every swapon, check if "SWSUSP" is there, and replace it with "SWAP-FILE" if so. (Currently it says -EINVAL). That should make it pretty safe.
Of course, you'll still be able to shoot yourself in the foot even with added "security". Just don't do it, then.
Pavel
Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected]
Quoted 5 lines · Pavel Machek
[Albert Cahalan]
Quoted 4 lines
[Pavel Machek]
Quoted 1 line
I can't do that: open deleted files.
Quoted 8 lines
Quoted 5 lines
Tough luck. Either use the same hack as NFS, or have such files return
-EIOfor all operations and give SIGBUS for mappings. Maybe just refuse to suspend when there are open deleted files. Oh, just create a name in the filesystem root and use that. Something like ".8fe4a979.swsusp" would be fine. Whatever!...and break locking and similar stuff. NFS is not as good as local filesystem.
Oh well. Network connections die and real-time apps fail too. It is important to have safe and useful behavior in the presence of arbitrary filesystem modifications. It is very nice to be able to use suspend/resume to alternate between two running kernels.
I wouldn't worry about locking. Write/discard all data on suspend, then examine the inode on resume. As long as the inode doesn't change by more than the atime, the lock can survive.
Hi!
Quoted 14 lines
Quoted 5 lines
[Albert Cahalan]
Quoted 4 lines
[Pavel Machek]
Quoted 1 line
I can't do that: open deleted files.
Quoted 8 lines
Quoted 5 lines
Tough luck. Either use the same hack as NFS, or have such files return
-EIOfor all operations and give SIGBUS for mappings. Maybe just refuse to suspend when there are open deleted files. Oh, just create a name in the filesystem root and use that. Something like ".8fe4a979.swsusp" would be fine. Whatever!...and break locking and similar stuff. NFS is not as good as local filesystem.
Quoted 8 lines
Oh well. Network connections die and real-time apps fail too. It is important to have safe and useful behavior in the presence of arbitrary filesystem modifications. It is very nice to be able to use suspend/resume to alternate between two running kernels.
I wouldn't worry about locking. Write/discard all data on suspend, then examine the inode on resume. As long as the inode doesn't change by more than the atime, the lock can survive.
And if did? So now semantics is "it somehow works in presence of FS modifications, but not completely"?
I look at it this way: ability to survive filesystem modifications would be nice, but it is quite hard to do. (Probably bigger diff than what I have, now.)
Admitedly, it would also be nice to be able for kernel *to survive arbitrary fs modifications without suspend-to-disk* -- imagine two machines sharing one SCSI disk. No other suspend-to-disk implementation I know of does what you describe. So I treat problems orthogonal. What you want is usefull (you can do forced unmount that way), but it is not required for software suspend.
Pavel
Signature · 2 lines
Casualities in World Trade Center: 6453 dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.