Opened 12 years ago

Last modified 3 months ago

#8971 assigned bug

When moving swap file locations, old swap file is left on each device

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Kernel Version: R1/Development
Keywords: Cc:
Blocked By: #7550 Blocking:
Platform: All

Description (last modified by kallisti5)

When you move swap locations, an old swap file is left on the previous device. This file can be erased by hand post-reboot, however it should be cleaned up automatically.

Process:

  • Swap file location changed by user
  • Swap file is in use by os... so it can't be erased
  • After reboot, kernel uses new swap file specified.
  • Old swap file still exists.

This is generally a problem of knowing where the old swap file *was* on reboot. a syscall may be a good solution (not requiring a reboot for swapfile changes, maybe a _kern_swap_reprovision call that will:

  • Make the kernel flush the swap file into memory (if possible or return a failure)
  • Make the kernel erase the current swap file from disk, and re-read the virtual_memory config to set up the new swap file.

Change History (7)

comment:1 by kallisti5, 12 years ago

Description: modified (diff)

comment:2 by axeld, 12 years ago

Why can't you just delete the file from the VirtualMemory preferences while it's still in use?

comment:3 by kallisti5, 12 years ago

I've done that in the past (erase the swap file while it's still in use)

Something goes horribly wrong and I have to run a checkfs to regain the space :-\

comment:4 by axeld, 12 years ago

Now that you mention that, that makes sense: the swap file is deleted, but its space can only be freed when the file is no longer in use. Unfortunately, the swap is never stopped to be used, so when the system reboots, the knowledge of freeing this file's space is gone.

A proper fix would be to shut down the swap file service when the system is shut down. This should be done immediately before unmounting/syncing the boot drive. In that case, the file should be removed correctly.

comment:5 by axeld, 8 years ago

Owner: changed from axeld to nobody
Status: newassigned

comment:6 by waddlesplash, 3 months ago

Blocked By: 7550 added

comment:7 by waddlesplash, 3 months ago

Milestone: R1Unscheduled
Note: See TracTickets for help on using tickets.