Commit 0c8c7c5
nfs: don't invalidate dentries on transient errors
This is a slight variation on a patch previously proposed by Neil Brown
that never got merged.
Prior to commit 5ceb9d7 ("NFS: Refactor nfs_lookup_revalidate()"),
any error from nfs_lookup_verify_inode() other than -ESTALE would result
in nfs_lookup_revalidate() returning that error (-ESTALE is mapped to
zero).
Since that commit, all errors result in nfs_lookup_revalidate()
returning zero, resulting in dentries being invalidated where they
previously were not (particularly in the case of -ERESTARTSYS).
Fix it by passing the actual error code to nfs_lookup_revalidate_done(),
and leaving the decision on whether to map the error code to zero or
one to nfs_lookup_revalidate_done().
A simple reproducer is to run the following python code in a
subdirectory of an NFS mount (not in the root of the NFS mount):
---8<---
import os
import multiprocessing
import time
if __name__=="__main__":
multiprocessing.set_start_method("spawn")
count = 0
while True:
try:
os.getcwd()
pool = multiprocessing.Pool(10)
pool.close()
pool.terminate()
count += 1
except Exception as e:
print(f"Failed after {count} iterations")
print(e)
break
---8<---
Prior to commit 5ceb9d7, the above code would run indefinitely.
After commit 5ceb9d7, it fails almost immediately with -ENOENT.
Signed-off-by: Scott Mayhew <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>1 parent a527c3b commit 0c8c7c5
1 file changed
+13
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1627 | 1627 | | |
1628 | 1628 | | |
1629 | 1629 | | |
1630 | | - | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1631 | 1640 | | |
1632 | 1641 | | |
1633 | 1642 | | |
| |||
1682 | 1691 | | |
1683 | 1692 | | |
1684 | 1693 | | |
1685 | | - | |
1686 | | - | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
| 1694 | + | |
1695 | 1695 | | |
1696 | | - | |
1697 | 1696 | | |
1698 | 1697 | | |
1699 | 1698 | | |
| |||
1737 | 1736 | | |
1738 | 1737 | | |
1739 | 1738 | | |
1740 | | - | |
| 1739 | + | |
1741 | 1740 | | |
1742 | 1741 | | |
1743 | 1742 | | |
| |||
1782 | 1781 | | |
1783 | 1782 | | |
1784 | 1783 | | |
1785 | | - | |
| 1784 | + | |
1786 | 1785 | | |
1787 | 1786 | | |
1788 | 1787 | | |
| |||
0 commit comments