aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-05-04 01:08:02 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:28 -0400
commit1cd3935bedccf592d44343890251452a6dd74fc4 (patch)
treeb088e425d19dbca7d7702e9f1bfa0b2dfa85eba0 /fs/ceph/dir.c
parent1b7facc41b42c2ab904b2f88b64b1f8ca0ca6cb7 (diff)
ceph: set dn offset when spliced
We want to assign an offset when the dentry goes from null to linked, which is always done by splice_dentry(). Notably, we should NOT assign an offset when a dentry is first created and is still null. BUG if we try to splice a non-null dentry (we shouldn't). 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, 7 insertions, 6 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 0b0a39d05ca6..d3bb8132a1aa 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -128,7 +128,8 @@ more:
128 dentry = list_entry(p, struct dentry, d_u.d_child); 128 dentry = list_entry(p, struct dentry, d_u.d_child);
129 di = ceph_dentry(dentry); 129 di = ceph_dentry(dentry);
130 while (1) { 130 while (1) {
131 dout(" p %p/%p d_subdirs %p/%p\n", p->prev, p->next, 131 dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next,
132 d_unhashed(dentry) ? "!hashed" : "hashed",
132 parent->d_subdirs.prev, parent->d_subdirs.next); 133 parent->d_subdirs.prev, parent->d_subdirs.next);
133 if (p == &parent->d_subdirs) { 134 if (p == &parent->d_subdirs) {
134 fi->at_end = 1; 135 fi->at_end = 1;
@@ -571,7 +572,6 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
571 !is_root_ceph_dentry(dir, dentry) && 572 !is_root_ceph_dentry(dir, dentry) &&
572 (ci->i_ceph_flags & CEPH_I_COMPLETE) && 573 (ci->i_ceph_flags & CEPH_I_COMPLETE) &&
573 (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { 574 (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) {
574 di->offset = ci->i_max_offset++;
575 spin_unlock(&dir->i_lock); 575 spin_unlock(&dir->i_lock);
576 dout(" dir %p complete, -ENOENT\n", dir); 576 dout(" dir %p complete, -ENOENT\n", dir);
577 d_add(dentry, NULL); 577 d_add(dentry, NULL);
@@ -984,8 +984,9 @@ static int ceph_d_revalidate(struct dentry *dentry, struct nameidata *nd)
984{ 984{
985 struct inode *dir = dentry->d_parent->d_inode; 985 struct inode *dir = dentry->d_parent->d_inode;
986 986
987 dout("d_revalidate %p '%.*s' inode %p\n", dentry, 987 dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry,
988 dentry->d_name.len, dentry->d_name.name, dentry->d_inode); 988 dentry->d_name.len, dentry->d_name.name, dentry->d_inode,
989 ceph_dentry(dentry)->offset);
989 990
990 /* always trust cached snapped dentries, snapdir dentry */ 991 /* always trust cached snapped dentries, snapdir dentry */
991 if (ceph_snap(dir) != CEPH_NOSNAP) { 992 if (ceph_snap(dir) != CEPH_NOSNAP) {
@@ -1177,8 +1178,8 @@ void ceph_dentry_lru_touch(struct dentry *dn)
1177 struct ceph_dentry_info *di = ceph_dentry(dn); 1178 struct ceph_dentry_info *di = ceph_dentry(dn);
1178 struct ceph_mds_client *mdsc; 1179 struct ceph_mds_client *mdsc;
1179 1180
1180 dout("dentry_lru_touch %p %p '%.*s'\n", di, dn, 1181 dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn,
1181 dn->d_name.len, dn->d_name.name); 1182 dn->d_name.len, dn->d_name.name, di->offset);
1182 if (di) { 1183 if (di) {
1183 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc; 1184 mdsc = &ceph_sb_to_client(dn->d_sb)->mdsc;
1184 spin_lock(&mdsc->dentry_lru_lock); 1185 spin_lock(&mdsc->dentry_lru_lock);