Skip to content

Commit

Permalink
sanitize ->fsync() for affs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Al Viro committed Jun 12, 2009
1 parent 4427f0c commit c475879
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions fs/affs/affs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
2 changes: 1 addition & 1 deletion fs/affs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

/*
Expand Down
14 changes: 13 additions & 1 deletion fs/affs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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;
}

0 comments on commit c475879

Please sign in to comment.