Skip to content

Commit cefcf24

Browse files
Thomas Zeitlhoferrafaeljw
authored andcommitted
PM: hibernate: use correct mode for swsusp_close()
Commit 39fbef4 ("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: 39fbef4 ("PM: hibernate: Get block device exclusively in swsusp_check()") Signed-off-by: Thomas Zeitlhofer <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1360572 commit cefcf24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/power/hibernate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int load_image_and_restore(void)
693693
goto Unlock;
694694

695695
error = swsusp_read(&flags);
696-
swsusp_close(FMODE_READ);
696+
swsusp_close(FMODE_READ | FMODE_EXCL);
697697
if (!error)
698698
error = hibernation_restore(flags & SF_PLATFORM_MODE);
699699

@@ -983,7 +983,7 @@ static int software_resume(void)
983983
/* The snapshot device should not be opened while we're running */
984984
if (!hibernate_acquire()) {
985985
error = -EBUSY;
986-
swsusp_close(FMODE_READ);
986+
swsusp_close(FMODE_READ | FMODE_EXCL);
987987
goto Unlock;
988988
}
989989

@@ -1018,7 +1018,7 @@ static int software_resume(void)
10181018
pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
10191019
return error;
10201020
Close_Finish:
1021-
swsusp_close(FMODE_READ);
1021+
swsusp_close(FMODE_READ | FMODE_EXCL);
10221022
goto Finish;
10231023
}
10241024

0 commit comments

Comments
 (0)