Commit 97d79b40 authored by Yehuda Sadeh's avatar Yehuda Sadeh Committed by Sage Weil

ceph: keep reference to parent inode on ceph_dentry

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 949854d0, 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: default avatarYehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent e8e1ba96
...@@ -60,6 +60,7 @@ int ceph_init_dentry(struct dentry *dentry) ...@@ -60,6 +60,7 @@ int ceph_init_dentry(struct dentry *dentry)
} }
di->dentry = dentry; di->dentry = dentry;
di->lease_session = NULL; di->lease_session = NULL;
di->parent_inode = igrab(dentry->d_parent->d_inode);
dentry->d_fsdata = di; dentry->d_fsdata = di;
dentry->d_time = jiffies; dentry->d_time = jiffies;
ceph_dentry_lru_add(dentry); ceph_dentry_lru_add(dentry);
...@@ -1025,7 +1026,7 @@ static void ceph_dentry_release(struct dentry *dentry) ...@@ -1025,7 +1026,7 @@ static void ceph_dentry_release(struct dentry *dentry)
u64 snapid = CEPH_NOSNAP; u64 snapid = CEPH_NOSNAP;
if (!IS_ROOT(dentry)) { if (!IS_ROOT(dentry)) {
parent_inode = dentry->d_parent->d_inode; parent_inode = di->parent_inode;
if (parent_inode) if (parent_inode)
snapid = ceph_snap(parent_inode); snapid = ceph_snap(parent_inode);
} }
...@@ -1050,6 +1051,8 @@ static void ceph_dentry_release(struct dentry *dentry) ...@@ -1050,6 +1051,8 @@ static void ceph_dentry_release(struct dentry *dentry)
kmem_cache_free(ceph_dentry_cachep, di); kmem_cache_free(ceph_dentry_cachep, di);
dentry->d_fsdata = NULL; dentry->d_fsdata = NULL;
} }
if (parent_inode)
iput(parent_inode);
} }
static int ceph_snapdir_d_revalidate(struct dentry *dentry, static int ceph_snapdir_d_revalidate(struct dentry *dentry,
......
...@@ -207,6 +207,7 @@ struct ceph_dentry_info { ...@@ -207,6 +207,7 @@ struct ceph_dentry_info {
struct dentry *dentry; struct dentry *dentry;
u64 time; u64 time;
u64 offset; u64 offset;
struct inode *parent_inode;
}; };
struct ceph_inode_xattrs_info { struct ceph_inode_xattrs_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment