Skip to content

Commit

Permalink
ceph: initialize root dentry
Browse files Browse the repository at this point in the history
Set up d_fsdata on the root dentry.  This fixes a NULL pointer dereference
in ceph_d_prune on umount.  It also means we can eventually strip out all
of the conditional checks on d_fsdata because it is now set unconditionally
(prior to setting up the d_ops).

Fix the ceph_d_prune debug print while we're here.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Nov 11, 2011
1 parent 15a2015 commit 774ac21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ static void ceph_d_prune(struct dentry *dentry)
{
struct ceph_dentry_info *di;

dout("d_release %p\n", dentry);
dout("ceph_d_prune %p\n", dentry);

/* do we have a valid parent? */
if (!dentry->d_parent || IS_ROOT(dentry))
Expand Down
6 changes: 4 additions & 2 deletions fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,12 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
if (err == 0) {
dout("open_root_inode success\n");
if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT &&
fsc->sb->s_root == NULL)
fsc->sb->s_root == NULL) {
root = d_alloc_root(req->r_target_inode);
else
ceph_init_dentry(root);
} else {
root = d_obtain_alias(req->r_target_inode);
}
req->r_target_inode = NULL;
dout("open_root_inode success, root dentry is %p\n", root);
} else {
Expand Down

0 comments on commit 774ac21

Please sign in to comment.