diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:18:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:18:44 -0400 |
commit | ade61088bc77dd209f8edadbe544f1e5dad6c287 (patch) | |
tree | 50a2eb0b78a470f379801a5abc73ff822f1e47c0 /fs | |
parent | 7eb1053fd00a8f0e2263697638e17da8a251aa74 (diff) | |
parent | 0522f6adedd2736cbca3c0e16ca51df668993eee (diff) |
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
NFS: Fix another nfs_wb_page() deadlock
NFS: Ensure that we mark the inode as dirty if we exit early from commit
NFS: Fix a lock imbalance typo in nfs_access_cache_shrinker
sunrpc: fix leak on error on socket xprt setup
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 1 | ||||
-rw-r--r-- | fs/nfs/write.c | 20 |
2 files changed, 17 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index ee9a179ebdf3..db64854b7b09 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1741,6 +1741,7 @@ remove_lru_entry: | |||
1741 | clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); | 1741 | clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); |
1742 | smp_mb__after_clear_bit(); | 1742 | smp_mb__after_clear_bit(); |
1743 | } | 1743 | } |
1744 | spin_unlock(&inode->i_lock); | ||
1744 | } | 1745 | } |
1745 | spin_unlock(&nfs_access_lru_lock); | 1746 | spin_unlock(&nfs_access_lru_lock); |
1746 | nfs_access_free_list(&head); | 1747 | nfs_access_free_list(&head); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3aea3ca98ab7..91679e2631ee 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 | ||
@@ -1509,14 +1518,17 @@ int nfs_wb_page(struct inode *inode, struct page *page) | |||
1509 | }; | 1518 | }; |
1510 | int ret; | 1519 | int ret; |
1511 | 1520 | ||
1512 | while(PagePrivate(page)) { | 1521 | for (;;) { |
1513 | wait_on_page_writeback(page); | 1522 | wait_on_page_writeback(page); |
1514 | if (clear_page_dirty_for_io(page)) { | 1523 | if (clear_page_dirty_for_io(page)) { |
1515 | ret = nfs_writepage_locked(page, &wbc); | 1524 | ret = nfs_writepage_locked(page, &wbc); |
1516 | if (ret < 0) | 1525 | if (ret < 0) |
1517 | goto out_error; | 1526 | goto out_error; |
1527 | continue; | ||
1518 | } | 1528 | } |
1519 | ret = sync_inode(inode, &wbc); | 1529 | if (!PagePrivate(page)) |
1530 | break; | ||
1531 | ret = nfs_commit_inode(inode, FLUSH_SYNC); | ||
1520 | if (ret < 0) | 1532 | if (ret < 0) |
1521 | goto out_error; | 1533 | goto out_error; |
1522 | } | 1534 | } |