aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-05-14 12:35:38 -0400
committerSage Weil <sage@newdream.net>2010-05-17 13:25:45 -0400
commit81a6cf2d30eac5d790f53cdff110892f7b18c7fe (patch)
tree9dcc1d4492b8736cda6a007a4a1c076048bd87af /fs/ceph/dir.c
parentb4556396fac5b3f063d5b8ac54dc02f7612a75e1 (diff)
ceph: invalidate affected dentry leases on aborted requests
If we abort a request, we return to caller, but the request may still complete. And if we hold the dir FILE_EXCL bit, we may not release a lease when sending a request. A simple un-tar, control-c, un-tar again will reproduce the bug (manifested as a 'Cannot open: File exists'). Ensure we invalidate affected dentry leases (as well dir I_COMPLETE) so we don't have valid (but incorrect) leases. Do the same, consistently, at other sites where I_COMPLETE is similarly cleared. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c13
1 files changed, 11 insertions, 2 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 */
900void 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