Bug 165863

Summary: swsusp swaps should be reinitialized
Product: [Fedora] Fedora Reporter: Jeremy Katz <katzj>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: davej, notting
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-06 06:23:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 150222    

Description Jeremy Katz 2005-08-12 21:38:53 UTC
If you have a swap partition that's been used for swsuspend and you boot into a
different kernel, we should have the swapon re-initialize the swap to avoid
later resuming and causing data corruption.

We can either do this by adding some magic to rc.sysinit to look at every swap
partition and do the mkswap if needed or have swapon do it.

Comment 1 Bill Nottingham 2005-08-19 06:56:32 UTC
I vote for swapon. :)

Comment 2 Jeremy Katz 2005-08-19 14:39:25 UTC
Doesn't seem insane, so -> util-linux

Comment 3 Karel Zak 2005-08-22 07:02:42 UTC
I'm really not sure if destroy data on any partition automatically without
user's confirmation is good idea. I think clean solution should be something
like: "Detected old swsuspend partition. Do you want to re-initialize it to
standard system swap? (y/N)" ... and it's work for system startup scripts of
course :-)

It should not be problem add one "if [...]" before swapon call in rc.sysinit.

Comments? 

Comment 4 Jeremy Katz 2005-08-22 17:07:43 UTC
The problem is that if you _don't_ do it, then we get data corruption the next
time you boot the older kernel that you had suspended on.

Also, doing it from initscripts is not at all trivial given things like swap
labeling.

Comment 5 Karel Zak 2005-08-25 07:06:37 UTC
How can I detect swsuspend-swap partition? I mean difference between standard
system swap and swap with old swsuspend data. I need a way how determine when
call mkswap.

I think better than change something in the swapon command will be create new
swapstatus command that we can use in some if[...] in rc.sysinit. Things like
swap labeling aren't problem (see the blkid command) -- but label and uuid could
be part of swapstatus output too.

Comment 6 Jeremy Katz 2005-08-25 13:06:01 UTC
swsuspend changes the swap space header (typically SWAPSPACE2) to contain either
S1SUSP or S2SUSP, thus it's really easy to tell the difference.

Comment 7 Karel Zak 2005-08-26 12:52:37 UTC
Well, after investigation I think implement it to swapon is more simple way :-)

Comment 8 Karel Zak 2005-09-06 06:23:25 UTC
Implemented: util-linux-2.13-0.3.pre2