Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
[linux-2.6.git] / fs / ceph / super.c
index 9c62fe0..00de2c9 100644 (file)
@@ -351,11 +351,11 @@ out:
 /**
  * ceph_show_options - Show mount options in /proc/mounts
  * @m: seq_file to write to
- * @mnt: mount descriptor
+ * @root: root of that (sub)tree
  */
-static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
+static int ceph_show_options(struct seq_file *m, struct dentry *root)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(mnt->mnt_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
        struct ceph_mount_options *fsopt = fsc->mount_options;
        struct ceph_options *opt = fsc->client->options;
 
@@ -650,18 +650,26 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
        req->r_num_caps = 2;
        err = ceph_mdsc_do_request(mdsc, NULL, req);
        if (err == 0) {
+               struct inode *inode = req->r_target_inode;
+               req->r_target_inode = NULL;
                dout("open_root_inode success\n");
-               if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT &&
-                   fsc->sb->s_root == NULL)
-                       root = d_alloc_root(req->r_target_inode);
-               else
-                       root = d_obtain_alias(req->r_target_inode);
+               if (ceph_ino(inode) == CEPH_INO_ROOT &&
+                   fsc->sb->s_root == NULL) {
+                       root = d_alloc_root(inode);
+                       if (!root) {
+                               iput(inode);
+                               root = ERR_PTR(-ENOMEM);
+                               goto out;
+                       }
+               } else {
+                       root = d_obtain_alias(inode);
+               }
                ceph_init_dentry(root);
-               req->r_target_inode = NULL;
                dout("open_root_inode success, root dentry is %p\n", root);
        } else {
                root = ERR_PTR(err);
        }
+out:
        ceph_mdsc_put_request(req);
        return root;
 }