Skip to content

Commit

Permalink
ceph: keep reference to parent inode on ceph_dentry
Browse files Browse the repository at this point in the history
When creating a new dentry we now hold a reference to the parent
inode in the ceph_dentry.  This is required due to the new RCU
changes from 949854d, which set dentry->d_parent to NULL in d_kill before
calling the ->release() callback.  If/when that behavior is changed, we can
revert this hack.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Yehuda Sadeh authored and Sage Weil committed Feb 20, 2011
1 parent e8e1ba9 commit 97d79b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int ceph_init_dentry(struct dentry *dentry)
}
di->dentry = dentry;
di->lease_session = NULL;
di->parent_inode = igrab(dentry->d_parent->d_inode);
dentry->d_fsdata = di;
dentry->d_time = jiffies;
ceph_dentry_lru_add(dentry);
Expand Down Expand Up @@ -1025,7 +1026,7 @@ static void ceph_dentry_release(struct dentry *dentry)
u64 snapid = CEPH_NOSNAP;

if (!IS_ROOT(dentry)) {
parent_inode = dentry->d_parent->d_inode;
parent_inode = di->parent_inode;
if (parent_inode)
snapid = ceph_snap(parent_inode);
}
Expand All @@ -1050,6 +1051,8 @@ static void ceph_dentry_release(struct dentry *dentry)
kmem_cache_free(ceph_dentry_cachep, di);
dentry->d_fsdata = NULL;
}
if (parent_inode)
iput(parent_inode);
}

static int ceph_snapdir_d_revalidate(struct dentry *dentry,
Expand Down
1 change: 1 addition & 0 deletions fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ struct ceph_dentry_info {
struct dentry *dentry;
u64 time;
u64 offset;
struct inode *parent_inode;
};

struct ceph_inode_xattrs_info {
Expand Down

0 comments on commit 97d79b4

Please sign in to comment.