diff options
-rw-r--r-- | fs/ceph/dir.c | 13 | ||||
-rw-r--r-- | fs/ceph/inode.c | 13 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 7 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
4 files changed, 29 insertions, 5 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 650d2db5ed26..4b1a7a4bae0b 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -888,13 +888,22 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
888 | 888 | ||
889 | /* ensure target dentry is invalidated, despite | 889 | /* ensure target dentry is invalidated, despite |
890 | rehashing bug in vfs_rename_dir */ | 890 | rehashing bug in vfs_rename_dir */ |
891 | new_dentry->d_time = jiffies; | 891 | ceph_invalidate_dentry_lease(new_dentry); |
892 | ceph_dentry(new_dentry)->lease_shared_gen = 0; | ||
893 | } | 892 | } |
894 | ceph_mdsc_put_request(req); | 893 | ceph_mdsc_put_request(req); |
895 | return err; | 894 | return err; |
896 | } | 895 | } |
897 | 896 | ||
897 | /* | ||
898 | * Ensure a dentry lease will no longer revalidate. | ||
899 | */ | ||
900 | void ceph_invalidate_dentry_lease(struct dentry *dentry) | ||
901 | { | ||
902 | spin_lock(&dentry->d_lock); | ||
903 | dentry->d_time = jiffies; | ||
904 | ceph_dentry(dentry)->lease_shared_gen = 0; | ||
905 | spin_unlock(&dentry->d_lock); | ||
906 | } | ||
898 | 907 | ||
899 | /* | 908 | /* |
900 | * Check if dentry lease is valid. If not, delete the lease. Try to | 909 | * Check if dentry lease is valid. If not, delete the lease. Try to |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 85b4d2ffdeba..220a2aec0545 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -938,8 +938,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
938 | ceph_inode(req->r_locked_dir); | 938 | ceph_inode(req->r_locked_dir); |
939 | dout(" clearing %p complete (empty trace)\n", | 939 | dout(" clearing %p complete (empty trace)\n", |
940 | req->r_locked_dir); | 940 | req->r_locked_dir); |
941 | spin_lock(&req->r_locked_dir->i_lock); | ||
941 | ci->i_ceph_flags &= ~CEPH_I_COMPLETE; | 942 | ci->i_ceph_flags &= ~CEPH_I_COMPLETE; |
942 | ci->i_release_count++; | 943 | ci->i_release_count++; |
944 | spin_unlock(&req->r_locked_dir->i_lock); | ||
945 | |||
946 | if (req->r_dentry) | ||
947 | ceph_invalidate_dentry_lease(req->r_dentry); | ||
948 | if (req->r_old_dentry) | ||
949 | ceph_invalidate_dentry_lease(req->r_old_dentry); | ||
943 | } | 950 | } |
944 | return 0; | 951 | return 0; |
945 | } | 952 | } |
@@ -1011,13 +1018,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1011 | req->r_old_dentry->d_name.len, | 1018 | req->r_old_dentry->d_name.len, |
1012 | req->r_old_dentry->d_name.name, | 1019 | req->r_old_dentry->d_name.name, |
1013 | dn, dn->d_name.len, dn->d_name.name); | 1020 | dn, dn->d_name.len, dn->d_name.name); |
1021 | |||
1014 | /* ensure target dentry is invalidated, despite | 1022 | /* ensure target dentry is invalidated, despite |
1015 | rehashing bug in vfs_rename_dir */ | 1023 | rehashing bug in vfs_rename_dir */ |
1016 | dn->d_time = jiffies; | 1024 | ceph_invalidate_dentry_lease(dn); |
1017 | ceph_dentry(dn)->lease_shared_gen = 0; | 1025 | |
1018 | /* take overwritten dentry's readdir offset */ | 1026 | /* take overwritten dentry's readdir offset */ |
1019 | ceph_dentry(req->r_old_dentry)->offset = | 1027 | ceph_dentry(req->r_old_dentry)->offset = |
1020 | ceph_dentry(dn)->offset; | 1028 | ceph_dentry(dn)->offset; |
1029 | |||
1021 | dn = req->r_old_dentry; /* use old_dentry */ | 1030 | dn = req->r_old_dentry; /* use old_dentry */ |
1022 | in = dn->d_inode; | 1031 | in = dn->d_inode; |
1023 | } | 1032 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index c0568fe3c0ba..76995a960432 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1732,12 +1732,17 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc, | |||
1732 | struct ceph_inode_info *ci = | 1732 | struct ceph_inode_info *ci = |
1733 | ceph_inode(req->r_locked_dir); | 1733 | ceph_inode(req->r_locked_dir); |
1734 | 1734 | ||
1735 | dout("aborted, clearing I_COMPLETE on %p\n", | 1735 | dout("aborted, clearing I_COMPLETE on %p, leases\n", |
1736 | req->r_locked_dir); | 1736 | req->r_locked_dir); |
1737 | spin_lock(&req->r_locked_dir->i_lock); | 1737 | spin_lock(&req->r_locked_dir->i_lock); |
1738 | ci->i_ceph_flags &= ~CEPH_I_COMPLETE; | 1738 | ci->i_ceph_flags &= ~CEPH_I_COMPLETE; |
1739 | ci->i_release_count++; | 1739 | ci->i_release_count++; |
1740 | spin_unlock(&req->r_locked_dir->i_lock); | 1740 | spin_unlock(&req->r_locked_dir->i_lock); |
1741 | |||
1742 | if (req->r_dentry) | ||
1743 | ceph_invalidate_dentry_lease(req->r_dentry); | ||
1744 | if (req->r_old_dentry) | ||
1745 | ceph_invalidate_dentry_lease(req->r_old_dentry); | ||
1741 | } | 1746 | } |
1742 | } else { | 1747 | } else { |
1743 | err = req->r_err; | 1748 | err = req->r_err; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 13513b80d87f..cfe3b0834d54 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -871,6 +871,7 @@ extern struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
871 | extern void ceph_dentry_lru_add(struct dentry *dn); | 871 | extern void ceph_dentry_lru_add(struct dentry *dn); |
872 | extern void ceph_dentry_lru_touch(struct dentry *dn); | 872 | extern void ceph_dentry_lru_touch(struct dentry *dn); |
873 | extern void ceph_dentry_lru_del(struct dentry *dn); | 873 | extern void ceph_dentry_lru_del(struct dentry *dn); |
874 | extern void ceph_invalidate_dentry_lease(struct dentry *dentry); | ||
874 | 875 | ||
875 | /* | 876 | /* |
876 | * our d_ops vary depending on whether the inode is live, | 877 | * our d_ops vary depending on whether the inode is live, |