Fix writing maj:min to /sys/power/resume (fixes hiberation with systemd)
Subsystems (2)
PATCH 1/1 Fix writing maj:min to /sys/power/resume (fixes hiberation with systemd)
resume_store() first calls lookup_bdev() and after tries to handle maj:min, but it does not reset the error before, hence if you will write maj:min you will get ENOENT:
# echo 259:2 >| /sys/power/resume
bash: echo: write error: No such file or directoryThis also should fix hiberation via systemd, since it uses this way.
--- kernel/power/hibernate.c | 1 + 1 file changed, 1 insertion(+)
kernel/power/hibernate.c +1 -0
@@ -1179,6 +1179,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,unsigned maj, min, offset;char *p, dummy; + error =0 ;if (sscanf (name,"%u:%u%c" , &maj, &min, &dummy) ==2 ||sscanf (name,"%u:%u:%u:%c" , &maj, &min, &offset, &dummy) ==3 ) {
Signature · 1 line
2.41.0
Quoted 8 lines · Azat Khuzhin
resume_store()first callslookup_bdev()and after tries to handle maj:min, but it does not reset the error before, hence if you will write maj:min you will get ENOENT:# echo 259:2 >| /sys/power/resume bash: echo: write error: No such file or directoryThis also should fix hiberation via systemd, since it uses this way.
Looks good:
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Azat Khuzhin
resume_store()first callslookup_bdev()and after tries to handle maj:min, but it does not reset the error before, hence if you will write maj:min you will get ENOENT:
Quoted 8 lines
Quoted 4 lines
# echo 259:2 >| /sys/power/resume bash: echo: write error: No such file or directoryThis also should fix hiberation via systemd, since it uses this way.
Looks good:
Reviewed-by Christoph Hellwig <[email protected]>
Applied as 6.5-rc material, thanks!