From: Junghoon Kim Date: Tue, 17 Oct 2017 05:43:04 +0000 (+0900) Subject: misc: tizen-inform-reboot: resolve sync failure about reboot parameter X-Git-Tag: accepted/tizen/unified/20230814.120944~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0008436c158ee4b4bbb85fe3cf14ca71783b6ff;p=platform%2Fkernel%2Flinux-rpi.git misc: tizen-inform-reboot: resolve sync failure about reboot parameter Currently, writing reboot paramter into INFORM partition fails infrequently. Resolve this issue by calling sync_filesystem function so that it writes out and waits upon all dirty data associated with this superblock. Change-Id: Ic62df0c3c4e565ca7211eb85661ead6979f0ad8d Signed-off-by: Junghoon Kim --- diff --git a/drivers/misc/tizen-inform-reboot.c b/drivers/misc/tizen-inform-reboot.c index 2e26186..08a0552 100644 --- a/drivers/misc/tizen-inform-reboot.c +++ b/drivers/misc/tizen-inform-reboot.c @@ -33,6 +33,8 @@ static int inform_reboot_notifier(struct notifier_block *nb, if (fd >= 0) { file = fget(fd); if (file) { + struct super_block *sb = file->f_path.dentry->d_sb; + if (cmd) { if (!strncmp(cmd, "fota", 4)) cmd = "upgr"; @@ -44,12 +46,14 @@ static int inform_reboot_notifier(struct notifier_block *nb, cmd = "norm"; vfs_write(file, cmd, strlen(cmd), &pos); - vfs_fsync(file, 0); + + down_read(&sb->s_umount); + sync_filesystem(sb); + up_read(&sb->s_umount); + fput(file); } sys_close(fd); - /* to guarantee all file data and metadata sync */ - emergency_sync(); } else { pr_err("Reboot parameter passing is failed.\n" "Inform file path should be described correctly in config.\n");