From 9f91558f7ee103190a93f6855dc75d4c198324af Mon Sep 17 00:00:00 2001 From: Junghoon Kim Date: Tue, 17 Oct 2017 14:43:04 +0900 Subject: [PATCH] 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 --- drivers/misc/tizen-inform-reboot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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"); -- 2.7.4