[merged] pm-hibernate-fix-swap-breaks-after-hibernation-failures.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     PM/hibernate: fix "swap breaks after hibernation failures"
has been removed from the -mm tree.  Its filename was
     pm-hibernate-fix-swap-breaks-after-hibernation-failures.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: PM/hibernate: fix "swap breaks after hibernation failures"
From: Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx>

Addresses 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@xxxxxxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/swapfile.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN mm/swapfile.c~pm-hibernate-fix-swap-breaks-after-hibernation-failures mm/swapfile.c
--- a/mm/swapfile.c~pm-hibernate-fix-swap-breaks-after-hibernation-failures
+++ a/mm/swapfile.c
@@ -635,7 +635,7 @@ int swap_type_of(dev_t device, sector_t 
 
 		if (!bdev) {
 			if (bdev_p)
-				*bdev_p = sis->bdev;
+				*bdev_p = bdget(sis->bdev->bd_dev);
 
 			spin_unlock(&swap_lock);
 			return i;
@@ -647,7 +647,7 @@ int swap_type_of(dev_t device, sector_t 
 					struct swap_extent, list);
 			if (se->start_block == offset) {
 				if (bdev_p)
-					*bdev_p = sis->bdev;
+					*bdev_p = bdget(sis->bdev->bd_dev);
 
 				spin_unlock(&swap_lock);
 				bdput(bdev);
_

Patches currently in -mm which might be from alan-jenkins@xxxxxxxxxxxxxx are


--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux