https://github.com/torvalds/linux
Revision a1bb7d61233ba5fb5cd865f907a9ddcc8f8c02bd authored by Alan Jenkins on 14 February 2009, 01:01:14 UTC, committed by Linus Torvalds on 21 February 2009, 22:17:17 UTC
http://bugzilla.kernel.org/show_bug.cgi?id=12239

The image writing code dropped a reference to the current swap device.
This doesn't show up if the hibernation succeeds - because it doesn't
affect the image which gets resumed.  But it means multiple _failed_
hibernations end up freeing the swap device while it is still use!

swsusp_write() finds the block device for the swap file using swap_type_of().
It then uses blkdev_get() / blkdev_put() to open and close the block device.

Unfortunately, blkdev_get() assumes ownership of the inode of the block_device
passed to it.  So blkdev_put() calls iput() on the inode.  This is by design
and other callers expect this behaviour.  The fix is for swap_type_of() to take
a reference on the inode using bdget().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent eed3ee0
History
Tip revision: a1bb7d61233ba5fb5cd865f907a9ddcc8f8c02bd authored by Alan Jenkins on 14 February 2009, 01:01:14 UTC
PM/hibernate: fix "swap breaks after hibernation failures"
Tip revision: a1bb7d6
File Mode Size
Kconfig -rw-r--r-- 6.5 KB
Makefile -rw-r--r-- 1.3 KB
allocpercpu.c -rw-r--r-- 4.0 KB
backing-dev.c -rw-r--r-- 7.0 KB
bootmem.c -rw-r--r-- 17.8 KB
bounce.c -rw-r--r-- 6.5 KB
dmapool.c -rw-r--r-- 12.9 KB
fadvise.c -rw-r--r-- 3.3 KB
failslab.c -rw-r--r-- 1.3 KB
filemap.c -rw-r--r-- 65.0 KB
filemap_xip.c -rw-r--r-- 11.0 KB
fremap.c -rw-r--r-- 6.7 KB
highmem.c -rw-r--r-- 8.7 KB
hugetlb.c -rw-r--r-- 61.0 KB
internal.h -rw-r--r-- 7.9 KB
maccess.c -rw-r--r-- 1.4 KB
madvise.c -rw-r--r-- 9.5 KB
memcontrol.c -rw-r--r-- 56.9 KB
memory.c -rw-r--r-- 86.1 KB
memory_hotplug.c -rw-r--r-- 20.8 KB
mempolicy.c -rw-r--r-- 59.3 KB
mempool.c -rw-r--r-- 9.0 KB
migrate.c -rw-r--r-- 25.7 KB
mincore.c -rw-r--r-- 5.7 KB
mlock.c -rw-r--r-- 16.6 KB
mm_init.c -rw-r--r-- 3.7 KB
mmap.c -rw-r--r-- 64.3 KB
mmu_notifier.c -rw-r--r-- 8.2 KB
mmzone.c -rw-r--r-- 1.5 KB
mprotect.c -rw-r--r-- 7.6 KB
mremap.c -rw-r--r-- 11.1 KB
msync.c -rw-r--r-- 2.4 KB
nommu.c -rw-r--r-- 45.9 KB
oom_kill.c -rw-r--r-- 16.4 KB
page-writeback.c -rw-r--r-- 39.7 KB
page_alloc.c -rw-r--r-- 130.2 KB
page_cgroup.c -rw-r--r-- 10.6 KB
page_io.c -rw-r--r-- 3.4 KB
page_isolation.c -rw-r--r-- 3.6 KB
pagewalk.c -rw-r--r-- 3.2 KB
pdflush.c -rw-r--r-- 6.6 KB
prio_tree.c -rw-r--r-- 6.3 KB
quicklist.c -rw-r--r-- 2.4 KB
readahead.c -rw-r--r-- 13.4 KB
rmap.c -rw-r--r-- 34.2 KB
shmem.c -rw-r--r-- 67.9 KB
shmem_acl.c -rw-r--r-- 4.6 KB
slab.c -rw-r--r-- 115.1 KB
slob.c -rw-r--r-- 16.0 KB
slub.c -rw-r--r-- 105.9 KB
sparse-vmemmap.c -rw-r--r-- 4.2 KB
sparse.c -rw-r--r-- 16.2 KB
swap.c -rw-r--r-- 14.5 KB
swap_state.c -rw-r--r-- 10.1 KB
swapfile.c -rw-r--r-- 50.5 KB
thrash.c -rw-r--r-- 2.0 KB
truncate.c -rw-r--r-- 13.0 KB
util.c -rw-r--r-- 3.9 KB
vmalloc.c -rw-r--r-- 43.0 KB
vmscan.c -rw-r--r-- 72.6 KB
vmstat.c -rw-r--r-- 22.8 KB

back to top