Skip to content

Commit

Permalink
nfsd: make sure data is on disk before calling ->fsync
Browse files Browse the repository at this point in the history
nfsd is not using vfs_fsync, so I missed it when changing the calling
convention during the 2.6.32 window.  This patch fixes it to not only
start the data writeout, but also wait for it to complete before calling
into ->fsync.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: stable@kernel.org
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
Christoph Hellwig authored and J. Bruce Fields committed Jan 6, 2010
1 parent f69ac2f commit 7211a4e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,9 @@ static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
int (*fsync) (struct file *, struct dentry *, int);
int err;

err = filemap_fdatawrite(inode->i_mapping);
err = filemap_write_and_wait(inode->i_mapping);
if (err == 0 && fop && (fsync = fop->fsync))
err = fsync(filp, dp, 0);
if (err == 0)
err = filemap_fdatawait(inode->i_mapping);

return err;
}

Expand Down

0 comments on commit 7211a4e

Please sign in to comment.