diff options
Diffstat (limited to 'fs/nfs/dir.c')
| -rw-r--r-- | fs/nfs/dir.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 625d8e5fb39d..3df428816559 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include "delegation.h" | 38 | #include "delegation.h" |
| 39 | #include "iostat.h" | 39 | #include "iostat.h" |
| 40 | 40 | ||
| 41 | #define NFS_PARANOIA 1 | ||
| 42 | /* #define NFS_DEBUG_VERBOSE 1 */ | 41 | /* #define NFS_DEBUG_VERBOSE 1 */ |
| 43 | 42 | ||
| 44 | static int nfs_opendir(struct inode *, struct file *); | 43 | static int nfs_opendir(struct inode *, struct file *); |
| @@ -650,12 +649,15 @@ int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync) | |||
| 650 | */ | 649 | */ |
| 651 | static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) | 650 | static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) |
| 652 | { | 651 | { |
| 652 | unsigned long verf; | ||
| 653 | |||
| 653 | if (IS_ROOT(dentry)) | 654 | if (IS_ROOT(dentry)) |
| 654 | return 1; | 655 | return 1; |
| 655 | if ((NFS_I(dir)->cache_validity & NFS_INO_INVALID_ATTR) != 0 | 656 | verf = (unsigned long)dentry->d_fsdata; |
| 656 | || nfs_attribute_timeout(dir)) | 657 | if (nfs_caches_unstable(dir) |
| 658 | || verf != NFS_I(dir)->cache_change_attribute) | ||
| 657 | return 0; | 659 | return 0; |
| 658 | return nfs_verify_change_attribute(dir, (unsigned long)dentry->d_fsdata); | 660 | return 1; |
| 659 | } | 661 | } |
| 660 | 662 | ||
| 661 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | 663 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) |
| @@ -665,8 +667,7 @@ static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | |||
| 665 | 667 | ||
| 666 | static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf) | 668 | static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf) |
| 667 | { | 669 | { |
| 668 | if (time_after(verf, (unsigned long)dentry->d_fsdata)) | 670 | nfs_set_verifier(dentry, verf); |
| 669 | nfs_set_verifier(dentry, verf); | ||
| 670 | } | 671 | } |
| 671 | 672 | ||
| 672 | /* | 673 | /* |
| @@ -765,6 +766,10 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
| 765 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); | 766 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); |
| 766 | inode = dentry->d_inode; | 767 | inode = dentry->d_inode; |
| 767 | 768 | ||
| 769 | /* Revalidate parent directory attribute cache */ | ||
| 770 | if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0) | ||
| 771 | goto out_zap_parent; | ||
| 772 | |||
| 768 | if (!inode) { | 773 | if (!inode) { |
| 769 | if (nfs_neg_need_reval(dir, dentry, nd)) | 774 | if (nfs_neg_need_reval(dir, dentry, nd)) |
| 770 | goto out_bad; | 775 | goto out_bad; |
| @@ -778,10 +783,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
| 778 | goto out_bad; | 783 | goto out_bad; |
| 779 | } | 784 | } |
| 780 | 785 | ||
| 781 | /* Revalidate parent directory attribute cache */ | ||
| 782 | if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0) | ||
| 783 | goto out_zap_parent; | ||
| 784 | |||
| 785 | /* Force a full look up iff the parent directory has changed */ | 786 | /* Force a full look up iff the parent directory has changed */ |
| 786 | if (nfs_check_verifier(dir, dentry)) { | 787 | if (nfs_check_verifier(dir, dentry)) { |
| 787 | if (nfs_lookup_verify_inode(inode, nd)) | 788 | if (nfs_lookup_verify_inode(inode, nd)) |
| @@ -1360,11 +1361,6 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
| 1360 | atomic_read(&dentry->d_count)); | 1361 | atomic_read(&dentry->d_count)); |
| 1361 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); | 1362 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); |
| 1362 | 1363 | ||
| 1363 | #ifdef NFS_PARANOIA | ||
| 1364 | if (!dentry->d_inode) | ||
| 1365 | printk("NFS: silly-renaming %s/%s, negative dentry??\n", | ||
| 1366 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
| 1367 | #endif | ||
| 1368 | /* | 1364 | /* |
| 1369 | * We don't allow a dentry to be silly-renamed twice. | 1365 | * We don't allow a dentry to be silly-renamed twice. |
| 1370 | */ | 1366 | */ |
| @@ -1681,16 +1677,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1681 | new_inode = NULL; | 1677 | new_inode = NULL; |
| 1682 | /* instantiate the replacement target */ | 1678 | /* instantiate the replacement target */ |
| 1683 | d_instantiate(new_dentry, NULL); | 1679 | d_instantiate(new_dentry, NULL); |
| 1684 | } else if (atomic_read(&new_dentry->d_count) > 1) { | 1680 | } else if (atomic_read(&new_dentry->d_count) > 1) |
| 1685 | /* dentry still busy? */ | 1681 | /* dentry still busy? */ |
| 1686 | #ifdef NFS_PARANOIA | ||
| 1687 | printk("nfs_rename: target %s/%s busy, d_count=%d\n", | ||
| 1688 | new_dentry->d_parent->d_name.name, | ||
| 1689 | new_dentry->d_name.name, | ||
| 1690 | atomic_read(&new_dentry->d_count)); | ||
| 1691 | #endif | ||
| 1692 | goto out; | 1682 | goto out; |
| 1693 | } | ||
| 1694 | } else | 1683 | } else |
| 1695 | drop_nlink(new_inode); | 1684 | drop_nlink(new_inode); |
| 1696 | 1685 | ||
