From: Christoph Hellwig Date: Fri, 25 Dec 2009 16:44:45 +0000 (+0100) Subject: nfsd: make sure data is on disk before calling ->fsync X-Git-Tag: v2.6.33-rc4~80^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=7211a4e859ad070b28545c06e0a6cb60b3b8aa31;p=linux-2.6-block.git nfsd: make sure data is on disk before calling ->fsync 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 Cc: stable@kernel.org Signed-off-by: J. Bruce Fields --- diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index e3ef3ec0efd0..d5fe17cb07e3 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -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; }