diff options
Diffstat (limited to 'fs/nfs/write.c')
-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 3aea3ca98ab7..b8a6d7af2a1d 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) | |||
1386 | int res = 0; | 1386 | int res = 0; |
1387 | 1387 | ||
1388 | if (!nfs_commit_set_lock(NFS_I(inode), may_wait)) | 1388 | if (!nfs_commit_set_lock(NFS_I(inode), may_wait)) |
1389 | goto out; | 1389 | goto out_mark_dirty; |
1390 | spin_lock(&inode->i_lock); | 1390 | spin_lock(&inode->i_lock); |
1391 | res = nfs_scan_commit(inode, &head, 0, 0); | 1391 | res = nfs_scan_commit(inode, &head, 0, 0); |
1392 | spin_unlock(&inode->i_lock); | 1392 | spin_unlock(&inode->i_lock); |
@@ -1398,9 +1398,18 @@ static int nfs_commit_inode(struct inode *inode, int how) | |||
1398 | wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT, | 1398 | wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT, |
1399 | nfs_wait_bit_killable, | 1399 | nfs_wait_bit_killable, |
1400 | TASK_KILLABLE); | 1400 | TASK_KILLABLE); |
1401 | else | ||
1402 | goto out_mark_dirty; | ||
1401 | } else | 1403 | } else |
1402 | nfs_commit_clear_lock(NFS_I(inode)); | 1404 | nfs_commit_clear_lock(NFS_I(inode)); |
1403 | out: | 1405 | return res; |
1406 | /* Note: If we exit without ensuring that the commit is complete, | ||
1407 | * we must mark the inode as dirty. Otherwise, future calls to | ||
1408 | * sync_inode() with the WB_SYNC_ALL flag set will fail to ensure | ||
1409 | * that the data is on the disk. | ||
1410 | */ | ||
1411 | out_mark_dirty: | ||
1412 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
1404 | return res; | 1413 | return res; |
1405 | } | 1414 | } |
1406 | 1415 | ||