]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge branch 'rados' of ssh://yehudasa@ceph.newdream.net/git/ceph into myrados
authorYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Fri, 18 Jan 2008 21:15:22 +0000 (23:15 +0200)
committerYehuda Sadeh-Weinraub <yehuda@yehuda.infit.com>
Fri, 18 Jan 2008 21:15:22 +0000 (23:15 +0200)
Conflicts:

src/kernel/client.c
src/kernel/inode.c

1  2 
src/kernel/client.c
src/kernel/dir.c
src/kernel/inode.c
src/kernel/super.c
src/kernel/super.h

index ab53c47c7f1672c960626e22b1d78f9bdb61715a,f992a154ab2b36c7caad07ecb7736224d0e07868..adc05fcd0a7284fe46ba3910fac0530cb4e44d47
@@@ -91,7 -90,7 +90,8 @@@ static int open_root_inode(struct ceph_
        int err;
        struct ceph_inode_cap *cap;
        struct ceph_inode_info *ci;
 -      
++      int alloc_fs = 0;
 +
        /* open dir */
        dout(30, "open_root_inode opening '%s'\n", args->path);
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, 1, args->path, 0, 0);
                return err;
        
        err = le32_to_cpu(rinfo.head->result);
-       if (err != 0)
-               return err;
+       if (err != 0) 
+               goto out;
        if (rinfo.trace_nr == 0) {
                dout(10, "open_root_inode wtf, mds returns 0 but no trace\n");
--              err = -EINVAL;
++              return -EINVAL;
        }
  
 -      /* create root inode */
 -      inode = iget_locked(client->sb, rinfo.trace_in[rinfo.trace_nr-1].in->ino);
 -      if (inode == NULL) {
 -              err = -ENOMEM;
 -              goto out;
 +      fs_root = client->sb->s_root;
 +      if (fs_root == NULL) {
 +              /* get the fs root inode. Note that this is not necessarily the root of
 +                 the mount */
 +              err = ceph_get_inode(client->sb, le64_to_cpu(rinfo.trace_in[0].in->ino), &root_inode);
 +              if (err < 0) {
-                       return err;
++                      goto out;
 +              }
++              alloc_fs = 1;
 +
 +              fs_root = d_alloc_root(root_inode);
 +              if (fs_root == NULL) {
 +                      err = -ENOMEM;
 +                      /* fixme: also close? */
-                       goto out;
++                      goto out2;
 +              }
 +              client->sb->s_root = fs_root;
 +      } else {
 +              root_inode = client->sb->s_root->d_inode;
 +
 +              BUG_ON (root_inode == NULL);
        }
 -      if (inode->i_state & I_NEW)
 -              unlock_new_inode(inode);
  
 -      if ((err = ceph_fill_inode(inode, rinfo.trace_in[rinfo.trace_nr-1].in)) < 0) 
 +      if ((err = ceph_fill_trace(client->sb, &rinfo, &mnt_inode, pmnt_root)) < 0)
-               goto out;
+               goto out2;
  
 +      BUG_ON(*pmnt_root == NULL);
 +
        /* fill in cap */
        frommds = rinfo.reply->hdr.src.name.num;
-       cap = ceph_add_cap(mnt_inode, frommds, 
 -      cap = ceph_add_cap(inode, session, 
++      cap = ceph_add_cap(mnt_inode, session, 
                           le32_to_cpu(rinfo.head->file_caps), 
                           le32_to_cpu(rinfo.head->file_caps_seq));
        if (IS_ERR(cap)) {
                err = PTR_ERR(cap);
-               goto out;
+               goto out2;
        }
 -      ci = ceph_inode(inode);
 -      ci->i_nr_by_mode[FILE_MODE_PIN]++;
  
 -      root = d_alloc_root(inode);
 -      if (root == NULL) {
 +      if (*pmnt_root == NULL) {
-               goto out;
+               err = -ENOMEM;
 -              /* fixme: also close? */
+               goto out2;
        }
 -      client->sb->s_root = root;
 -      dout(30, "open_root_inode success, root d is %p.\n", root);
 +      ci = ceph_inode(mnt_inode);
 +      ci->i_nr_by_mode[FILE_MODE_PIN]++;
 +
-       dout(30, "open_root_inode success.\n");
++      dout(30, "open_root_inode success, root d is %p.\n", fs_root);
        return 0;
  
- out:
+ out2:
        dout(30, "open_root_inode failure %d\n", err);
-       iput(root_inode);
 -      iput(inode);
++      if (alloc_fs)
++              iput(root_inode);
 +      iput(mnt_inode);
+ out:
+       ceph_mdsc_put_session(session);
        return err;
  }
  
Simple merge
index 4788b52f484d8c52defe825d7c22373eb03e6dc8,623a2e2481b235fb8d77724fc9ed5414580383c1..d1858b875d7ecf93e9a009da985df77fc383ad00
@@@ -12,24 -12,24 +12,40 @@@ int ceph_inode_debug = 50
  #define DOUT_PREFIX "inode: "
  #include "super.h"
  
- const struct inode_operations ceph_symlink_iops;
+ /*
+  * symlinks
+  */
+ static void * ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd)
+ {
+       struct ceph_inode_info *ci = ceph_inode(dentry->d_inode);
+       nd_set_link(nd, ci->i_symlink);
+       return NULL;
+ }
+ const struct inode_operations ceph_symlink_iops = {
+       .readlink = generic_readlink,
+       .follow_link = ceph_sym_follow_link,
+ };
  
 +int ceph_get_inode(struct super_block *sb, unsigned long ino, struct inode **pinode)
 +{
 +      BUG_ON(pinode == NULL);
 +
 +      *pinode = NULL;
 +
 +      *pinode = iget_locked(sb, ino);
 +
 +      if (*pinode == NULL) 
 +              return -ENOMEM;
 +      if ((*pinode)->i_state & I_NEW)
 +              unlock_new_inode(*pinode);
 +
 +      return 0;
 +}
 +
+ /*
+  * populate an inode based on info from mds
+  */
  int ceph_fill_inode(struct inode *inode, struct ceph_mds_reply_inode *info) 
  {
        struct ceph_inode_info *ci = ceph_inode(inode);
index 153cb3ee823786aedf33fad7fe2d2699cd6d4063,20e6b5bdc97696303bb734eb4b5469e57f75826c..38db859a8a69ff43adca43b3e0a5c816334e9f94
@@@ -118,9 -118,8 +120,10 @@@ static struct inode *ceph_alloc_inode(s
  static void ceph_destroy_inode(struct inode *inode)
  {
        struct ceph_inode_info *ci = ceph_inode(inode);
 +
 +      dout(30, "ceph_destroy_inode sb=%p inode=%lu\n", inode->i_sb, inode->i_ino);
        
+       dout(10, "destroy_inode %p vfsi %p\n", ci, inode);
        if (ci->i_caps != ci->i_caps_static) 
                kfree(ci->i_caps);
        if (ci->i_symlink)
index fe5fbfbebc5e2e2f757872bdf5a85501e3323961,6df30045673977c274a1690a59c3963c07f2cfb9..83eaded495e7addcd038f5a3e6d8899dec2e7817
@@@ -209,12 -214,10 +215,11 @@@ extern int ceph_mount(struct ceph_clien
  
  
  /* inode.c */
 +extern int ceph_get_inode(struct super_block *sb, unsigned long ino, struct inode **pinode);
  extern int ceph_fill_inode(struct inode *inode, struct ceph_mds_reply_inode *info);
  extern struct ceph_inode_cap *ceph_find_cap(struct inode *inode, int want);
- extern struct ceph_inode_cap *ceph_add_cap(struct inode *inode, int mds, u32 cap, u32 seq);
- extern int ceph_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,
-                             struct kstat *stat);
+ extern struct ceph_inode_cap *ceph_add_cap(struct inode *inode, struct ceph_mds_session *session, u32 cap, u32 seq);
+ extern void ceph_remove_caps(struct ceph_inode_info *ci);
  extern int ceph_handle_cap_grant(struct inode *inode, struct ceph_mds_file_caps *grant, struct ceph_mds_session *session);
  
  /* addr.c */