]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nfsd: make sure data is on disk before calling ->fsync
authorChristoph Hellwig <hch@lst.de>
Fri, 25 Dec 2009 16:44:45 +0000 (17:44 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 18 Jan 2010 18:19:18 +0000 (10:19 -0800)
commit 7211a4e859ad070b28545c06e0a6cb60b3b8aa31 upstream.

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>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfsd/vfs.c

index a293f0273263fb18dd1837a2a906769b8a9b71d6..570dd1c103d5b0809b6f6012ee201fee2fcb8a35 100644 (file)
@@ -774,12 +774,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;
 }