NFS: Ensure inode is always marked I_DIRTY_DATASYNC, if it has unstable pages
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 20 Feb 2010 01:03:18 +0000 (17:03 -0800)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 5 Mar 2010 20:44:54 +0000 (15:44 -0500)
Since nfs_scan_list() doesn't wait for locked pages, we have a race in
which it is possible to end up with an inode that needs to send a COMMIT,
but which does not have the I_DIRTY_DATASYNC flag set.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/write.c

index 704e67d392e5a8bd01c13e0c8b8010dea10691f5..e40e949598fd29e7eb2fa6dcae0bf2e8fa8d9a5f 100644 (file)
@@ -582,6 +582,8 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, u
        ret = nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT);
        if (ret > 0)
                nfsi->ncommit -= ret;
+       if (nfs_need_commit(NFS_I(inode)))
+               __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
        return ret;
 }
 #else