PM: hibernate: use correct mode for swsusp_close()
[ Upstream commitcefcf24b4d
] Commit39fbef4b0f
("PM: hibernate: Get block device exclusively in swsusp_check()") changed the opening mode of the block device to (FMODE_READ | FMODE_EXCL). In the corresponding calls to swsusp_close(), the mode is still just FMODE_READ which triggers the warning in blkdev_flush_mapping() on resume from hibernate. So, use the mode (FMODE_READ | FMODE_EXCL) also when closing the device. Fixes:39fbef4b0f
("PM: hibernate: Get block device exclusively in swsusp_check()") Signed-off-by: Thomas Zeitlhofer <thomas.zeitlhofer+lkml@ze-it.at> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8ba43fd0c6
commit
68945e9435
@ -677,7 +677,7 @@ static int load_image_and_restore(void)
|
|||||||
goto Unlock;
|
goto Unlock;
|
||||||
|
|
||||||
error = swsusp_read(&flags);
|
error = swsusp_read(&flags);
|
||||||
swsusp_close(FMODE_READ);
|
swsusp_close(FMODE_READ | FMODE_EXCL);
|
||||||
if (!error)
|
if (!error)
|
||||||
hibernation_restore(flags & SF_PLATFORM_MODE);
|
hibernation_restore(flags & SF_PLATFORM_MODE);
|
||||||
|
|
||||||
@ -874,7 +874,7 @@ static int software_resume(void)
|
|||||||
/* The snapshot device should not be opened while we're running */
|
/* The snapshot device should not be opened while we're running */
|
||||||
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
|
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
|
||||||
error = -EBUSY;
|
error = -EBUSY;
|
||||||
swsusp_close(FMODE_READ);
|
swsusp_close(FMODE_READ | FMODE_EXCL);
|
||||||
goto Unlock;
|
goto Unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,7 +910,7 @@ static int software_resume(void)
|
|||||||
pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
|
pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
|
||||||
return error;
|
return error;
|
||||||
Close_Finish:
|
Close_Finish:
|
||||||
swsusp_close(FMODE_READ);
|
swsusp_close(FMODE_READ | FMODE_EXCL);
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user