sanitize ->fsync() for affs
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Jun 2009 05:22:00 +0000 (01:22 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Jun 2009 01:36:14 +0000 (21:36 -0400)
unfortunately, for affs (especially for affs directories) we have
no real way to keep track of metadata ownership.  So we have to
do more or less what file_fsync() does, but we do *not* need to
call write_super() there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/affs/affs.h
fs/affs/dir.c
fs/affs/file.c

index 1a2d5e3c7f4eb5120dae33137d44cd0e9ef01849..e511dc621a2e64a45b09bcf21777e72d86added9 100644 (file)
@@ -182,6 +182,7 @@ extern int                   affs_add_entry(struct inode *dir, struct inode *inode, struct dent
 
 void           affs_free_prealloc(struct inode *inode);
 extern void    affs_truncate(struct inode *);
+int            affs_file_fsync(struct file *, struct dentry *, int);
 
 /* dir.c */
 
index 7b36904dbeac6b4774a6816c7a368c5a61b46741..8ca8f3a555992b849dfc45482c02a8deeff7908e 100644 (file)
@@ -21,7 +21,7 @@ const struct file_operations affs_dir_operations = {
        .read           = generic_read_dir,
        .llseek         = generic_file_llseek,
        .readdir        = affs_readdir,
-       .fsync          = file_fsync,
+       .fsync          = affs_file_fsync,
 };
 
 /*
index 9246cb4aa018fafa3517685e7d7fa1572f2e5a16..184e55c1c9ba4ec374752c5cf034ad80ac18c351 100644 (file)
@@ -34,7 +34,7 @@ const struct file_operations affs_file_operations = {
        .mmap           = generic_file_mmap,
        .open           = affs_file_open,
        .release        = affs_file_release,
-       .fsync          = file_fsync,
+       .fsync          = affs_file_fsync,
        .splice_read    = generic_file_splice_read,
 };
 
@@ -915,3 +915,15 @@ affs_truncate(struct inode *inode)
        }
        affs_free_prealloc(inode);
 }
+
+int affs_file_fsync(struct file *filp, struct dentry *dentry, int datasync)
+{
+       struct inode * inode = dentry->d_inode;
+       int ret, err;
+
+       ret = write_inode_now(inode, 0);
+       err = sync_blockdev(inode->i_sb->s_bdev);
+       if (!ret)
+               ret = err;
+       return ret;
+}