diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-04 17:30:15 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-01-11 19:28:25 -0500 |
commit | d46cfba5363a163851dc768f717f34185527a472 (patch) | |
tree | 18aaa9ab40b91b618ab206670de7a965f17589d1 /fs/ceph | |
parent | 56e925b677c5293e5aac73dac09e93b23259f907 (diff) |
ceph: always initialize the dentry in open_root_dentry()
When open_root_dentry() gets a dentry via d_obtain_alias() it does
not get initialized. If the dentry obtained came from the cache,
this is OK. But if not, the result is an improperly initialized
dentry.
To fix this, call ceph_init_dentry() regardless of which path
produced the dentry. That function returns immediately for a dentry
that is already initialized, it is safe to use either way.
(Credit to Sage, who suggested this fix.)
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/super.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index b48f15f101a0..ec74313e901f 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -638,12 +638,11 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc, | |||
638 | if (err == 0) { | 638 | if (err == 0) { |
639 | dout("open_root_inode success\n"); | 639 | dout("open_root_inode success\n"); |
640 | if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT && | 640 | if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT && |
641 | fsc->sb->s_root == NULL) { | 641 | fsc->sb->s_root == NULL) |
642 | root = d_alloc_root(req->r_target_inode); | 642 | root = d_alloc_root(req->r_target_inode); |
643 | ceph_init_dentry(root); | 643 | else |
644 | } else { | ||
645 | root = d_obtain_alias(req->r_target_inode); | 644 | root = d_obtain_alias(req->r_target_inode); |
646 | } | 645 | ceph_init_dentry(root); |
647 | req->r_target_inode = NULL; | 646 | req->r_target_inode = NULL; |
648 | dout("open_root_inode success, root dentry is %p\n", root); | 647 | dout("open_root_inode success, root dentry is %p\n", root); |
649 | } else { | 648 | } else { |