diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-26 08:42:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-05 11:22:56 -0700 |
commit | 53dc58fdce4053334b2f47e692d4769f92f41255 (patch) | |
tree | 44624cc1e417f84f518de3c6f537f8dbf99534ee | |
parent | 99d690620ac4810b175f207a09044004bc2b4d79 (diff) |
NFS: Ensure that we mark the inode as dirty if we exit early from commit
commit c5efa5fc91f1f6d1d47e65f39e7ec6d1157c777d upstream.
If we exit from nfs_commit_inode() without ensuring that the COMMIT rpc
call has been completed, we must re-mark the inode as dirty. Otherwise,
future calls to sync_inode() with the WB_SYNC_ALL flag set will fail to
ensure that the data is on the disk.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/nfs/write.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3aea3ca98ab..b8a6d7af2a1 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1386,7 +1386,7 @@ static int nfs_commit_inode(struct inode *inode, int how) int res = 0; if (!nfs_commit_set_lock(NFS_I(inode), may_wait)) - goto out; + goto out_mark_dirty; spin_lock(&inode->i_lock); res = nfs_scan_commit(inode, &head, 0, 0); spin_unlock(&inode->i_lock); @@ -1398,9 +1398,18 @@ static int nfs_commit_inode(struct inode *inode, int how) wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT, nfs_wait_bit_killable, TASK_KILLABLE); + else + goto out_mark_dirty; } else nfs_commit_clear_lock(NFS_I(inode)); -out: + return res; + /* Note: If we exit without ensuring that the commit is complete, + * we must mark the inode as dirty. Otherwise, future calls to + * sync_inode() with the WB_SYNC_ALL flag set will fail to ensure + * that the data is on the disk. + */ +out_mark_dirty: + __mark_inode_dirty(inode, I_DIRTY_DATASYNC); return res; } |