module: fixed receiving size
[p2p-kernel-protocol.git] / module / p2pkp_file.c
index 2d206a4..213b8de 100644 (file)
@@ -1,5 +1,6 @@
 #include <asm/uaccess.h>
 #include <linux/fs.h>
+#include <linux/buffer_head.h>
 
 #include "p2pkp_file.h"
 #include "p2pkp_debug.h"
@@ -20,6 +21,7 @@ struct file* p2pkp_open_file_write(const char *filename, mode_t mode)
 
 void p2pkp_close_file(struct file *file)
 {
+       file_fsync(file, 0);
        filp_close(file,NULL);
 }
 
@@ -50,9 +52,7 @@ int p2pkp_write_in_file(struct file *file, char *buffer, int len)
                len -= ret;
                bytes_written += ret;
        } while (len > 0);
-
        set_fs(fs);
-
        return ret < 0 ? ret : bytes_written;
 }