]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: make mds requests relative to inode or single dentry
authorSage Weil <sage@newdream.net>
Thu, 26 Mar 2009 19:52:43 +0000 (12:52 -0700)
committerSage Weil <sage@newdream.net>
Thu, 26 Mar 2009 20:10:52 +0000 (13:10 -0700)
src/kernel/dir.c
src/kernel/export.c
src/kernel/file.c
src/kernel/inode.c
src/kernel/ioctl.c
src/kernel/mds_client.c
src/kernel/mds_client.h
src/kernel/super.c
src/mds/Server.cc

index 94a193dee4c97736fe2e2dff0202e850fe87252d..257b621fab6a52a1075e5201d722b3361f40ed61 100644 (file)
@@ -81,10 +81,11 @@ nextfrag:
 
                dout(10, "readdir querying mds for ino %llx.%llx frag %x\n",
                     ceph_vinop(inode), frag);
-               req = ceph_mdsc_create_request(mdsc, op, filp->f_dentry, NULL,
-                                              NULL, NULL, USE_AUTH_MDS);
+               req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);
                if (IS_ERR(req))
                        return PTR_ERR(req);
+               req->r_inode = igrab(inode);
+               req->r_dentry = dget(filp->f_dentry);
                /* hints to request -> mds selection code */
                req->r_direct_mode = USE_AUTH_MDS;
                req->r_direct_hash = frag_value(frag);
@@ -310,11 +311,10 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
                spin_unlock(&dir->i_lock);
        }
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUP,
-                                      dentry, NULL, NULL, NULL,
-                                      USE_ANY_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUP, USE_ANY_MDS);
        if (IS_ERR(req))
                return ERR_PTR(PTR_ERR(req));
+       req->r_dentry = dget(dentry);
        /* we only need inode linkage */
        req->r_args.stat.mask = cpu_to_le32(CEPH_STAT_CAP_INODE);
        req->r_locked_dir = dir;
@@ -338,12 +338,12 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
 
        dout(5, "mknod in dir %p dentry %p mode 0%o rdev %d\n",
             dir, dentry, mode, rdev);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, dentry, NULL,
-                                      NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS);
        if (IS_ERR(req)) {
                d_drop(dentry);
                return PTR_ERR(req);
        }
+       req->r_dentry = dget(dentry);
        req->r_locked_dir = dir;
        req->r_args.mknod.mode = cpu_to_le32(mode);
        req->r_args.mknod.rdev = cpu_to_le32(rdev);
@@ -397,12 +397,13 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
                return -EROFS;
 
        dout(5, "symlink in dir %p dentry %p to '%s'\n", dir, dentry, dest);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SYMLINK,
-                                      dentry, NULL, NULL, dest, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SYMLINK, USE_AUTH_MDS);
        if (IS_ERR(req)) {
                d_drop(dentry);
                return PTR_ERR(req);
        }
+       req->r_dentry = dget(dentry);
+       req->r_path2 = dest;
        req->r_locked_dir = dir;
        if (!ceph_caps_issued_mask(ceph_inode(dir), CEPH_CAP_FILE_EXCL))
                ceph_release_caps(dir, CEPH_CAP_FILE_RDCACHE);
@@ -438,8 +439,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        } else {
                dout(5, "mkdir dir %p dn %p mode 0%o\n", dir, dentry, mode);
        }
-       req = ceph_mdsc_create_request(mdsc, op, pathdentry, NULL, 
-                                      NULL, snap, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);
        if (pathdentry != dentry)
                dput(pathdentry);
        if (IS_ERR(req)) {
@@ -447,7 +447,8 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode)
                err = PTR_ERR(req);
                goto out;
        }
-
+       req->r_dentry = dget(dentry);
+       req->r_path2 = snap;
        req->r_locked_dir = dir;
        req->r_args.mkdir.mode = cpu_to_le32(mode);
 
@@ -475,13 +476,13 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
 
        dout(5, "link in dir %p old_dentry %p dentry %p\n", dir,
             old_dentry, dentry);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LINK, dentry,
-                                      old_dentry, NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LINK, USE_AUTH_MDS);
        if (IS_ERR(req)) {
                d_drop(dentry);
                return PTR_ERR(req);
        }
-
+       req->r_dentry = dget(dentry);
+       req->r_old_dentry = dget(old_dentry); /* or inode? hrm. */
        req->r_locked_dir = dir;
 
        if (!ceph_caps_issued_mask(ceph_inode(dir), CEPH_CAP_FILE_EXCL))
@@ -532,15 +533,15 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
                dout(5, "unlink/rmdir dir %p dn %p inode %p\n",
                     dir, dentry, inode);
        }
-       req = ceph_mdsc_create_request(mdsc, op, pathdentry, NULL, NULL, snap,
-                                      USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);
        if (pathdentry != dentry)
                dput(pathdentry);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                goto out;
        }
-
+       req->r_dentry = dget(pathdentry);
+       req->r_path2 = snap;
        req->r_locked_dir = dir;
 
        if (!ceph_caps_issued_mask(ceph_inode(dir), CEPH_CAP_FILE_EXCL))
@@ -570,11 +571,11 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        dout(5, "rename dir %p dentry %p to dir %p dentry %p\n",
             old_dir, old_dentry, new_dir, new_dentry);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_RENAME,
-                                      new_dentry, old_dentry, NULL, NULL,
-                                      USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_RENAME, USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_dentry = dget(new_dentry);
+       req->r_old_dentry = dget(old_dentry);
        req->r_locked_dir = new_dir;
        if (!ceph_caps_issued_mask(ceph_inode(old_dir), CEPH_CAP_FILE_EXCL))
                ceph_release_caps(old_dir, CEPH_CAP_FILE_RDCACHE);
index 6c5b484768d94151bab29519ec05994f85081ffd..f44fc05c323653815b2bfa76ff6ca02c453e2310 100644 (file)
@@ -81,13 +81,12 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
        if (!inode) {
                struct ceph_mds_request *req;
                derr(10, "fh_to_dentry %llx.%x -- no inode\n", vino.ino, hash);
-               req = ceph_mdsc_create_request(mdsc,
-                                              CEPH_MDS_OP_FINDINODE,
-                                              NULL, NULL,
-                                              (char *)fh, (void *)&len,
+               req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_FINDINODE,
                                               USE_ANY_MDS);
                if (IS_ERR(req))
                        return ERR_PTR(PTR_ERR(req));
+               req->r_path1 = (char *)fh;
+               req->r_path2 = (void *)&len;
                err = ceph_mdsc_do_request(mdsc, NULL, req);
                ceph_mdsc_put_request(req);
                inode = ceph_find_inode(sb, vino);
index 1b3401160e018fb14ae242f82a41d448d9a1be73..ced8017b09ea594efaed99e4a39a7e93da91fc8c 100644 (file)
@@ -20,8 +20,7 @@ int ceph_debug_file __read_mostly = -1;
  * inopportune ENOMEM later.
  */
 static struct ceph_mds_request *
-prepare_open_request(struct super_block *sb, struct dentry *dentry,
-                    int flags, int create_mode)
+prepare_open_request(struct super_block *sb, int flags, int create_mode)
 {
        struct ceph_client *client = ceph_sb_to_client(sb);
        struct ceph_mds_client *mdsc = &client->mdsc;
@@ -31,10 +30,8 @@ prepare_open_request(struct super_block *sb, struct dentry *dentry,
        if (flags & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))
                want_auth = USE_AUTH_MDS;
 
-       dout(5, "prepare_open_request dentry %p name '%s' flags %d\n", dentry,
-            dentry->d_name.name, flags);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, dentry, NULL,
-                                      NULL, NULL, want_auth);
+       dout(5, "prepare_open_request flags %d\n", flags);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_OPEN, want_auth);
        if (IS_ERR(req))
                goto out;
        req->r_fmode = ceph_flags_to_mode(flags);
@@ -143,11 +140,12 @@ int ceph_open(struct inode *inode, struct file *file)
                return -ESTALE;  /* yuck */
        if (!ceph_caps_issued_mask(ceph_inode(inode), CEPH_CAP_FILE_EXCL))
                ceph_release_caps(inode, CEPH_CAP_FILE_RDCACHE);
-       req = prepare_open_request(inode->i_sb, dentry, flags, 0);
+       req = prepare_open_request(inode->i_sb, flags, 0);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                goto out;
        }
+       req->r_inode = igrab(inode);
        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
        if (!err)
                err = ceph_init_file(inode, file, req->r_fmode);
@@ -187,9 +185,10 @@ struct dentry *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
             dentry, dentry->d_name.len, dentry->d_name.name, flags, mode);
 
        /* do the open */
-       req = prepare_open_request(dir->i_sb, dentry, flags, mode);
+       req = prepare_open_request(dir->i_sb, flags, mode);
        if (IS_ERR(req))
                return ERR_PTR(PTR_ERR(req));
+       req->r_dentry = dget(dentry);
        if ((flags & O_CREAT) &&
            (!ceph_caps_issued_mask(ceph_inode(dir), CEPH_CAP_FILE_EXCL)))
                ceph_release_caps(dir, CEPH_CAP_FILE_RDCACHE);
index af96239b8b55bc3a1715a224850c2cc12fa20ffe..0b0a9916ce2afc583112242912ef9369fdc5cfb8 100644 (file)
@@ -866,9 +866,9 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
                             req->r_old_dentry->d_name.len,
                             req->r_old_dentry->d_name.name,
                             dn, dn->d_name.len, dn->d_name.name);
-                       dput(dn);  /* dn is dropped */
+                       //dput(dn);  /* dn is dropped */
                        dn = req->r_old_dentry;  /* use old_dentry */
-                       req->r_old_dentry = NULL;
+                       in = dn->d_inode;
                }
 
                /* null dentry? */
@@ -890,24 +890,31 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
                }
 
                /* attach proper inode */
-               BUG_ON(dn->d_inode);
-
                ininfo = rinfo->targeti.in;
                vino.ino = le64_to_cpu(ininfo->ino);
                vino.snap = le64_to_cpu(ininfo->snapid);
-               in = ceph_get_inode(dn->d_sb, vino);
-               if (IS_ERR(in)) {
-                       derr(30, "get_inode badness\n");
-                       err = PTR_ERR(in);
-                       d_delete(dn);
-                       goto done;
-               }
-               dn = splice_dentry(dn, in, &have_lease);
-               if (IS_ERR(dn)) {
-                       err = PTR_ERR(dn);
-                       goto done;
+               if (!dn->d_inode) {
+                       in = ceph_get_inode(dn->d_sb, vino);
+                       if (IS_ERR(in)) {
+                               derr(30, "get_inode badness\n");
+                               err = PTR_ERR(in);
+                               d_delete(dn);
+                               goto done;
+                       }
+                       dn = splice_dentry(dn, in, &have_lease);
+                       if (IS_ERR(dn)) {
+                               err = PTR_ERR(dn);
+                               goto done;
+                       }
+                       req->r_dentry = dn;  /* may have spliced */
+               } else if (ceph_ino(in) != vino.ino ||
+                          ceph_snap(in) != vino.snap) {
+                       dout(10, " %p links to %p %llx.%llx, not %llx.%llx\n",
+                            dn, in, ceph_ino(in), ceph_snap(in),
+                            vino.ino, vino.snap);
+                       have_lease = false;
+                       in = NULL;
                }
-               req->r_dentry = dn;  /* may have changed from the splice */
 
                if (have_lease)
                        update_dentry_lease(dn, rinfo->dlease, session,
@@ -1228,10 +1235,10 @@ static int ceph_setattr_chown(struct dentry *dentry, struct iattr *attr)
        }
        spin_unlock(&inode->i_lock);
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LCHOWN, dentry, NULL,
-                                      NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LCHOWN, USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        if (ia_valid & ATTR_UID) {
                req->r_args.chown.uid = cpu_to_le32(attr->ia_uid);
                mask |= CEPH_CHOWN_UID;
@@ -1269,10 +1276,10 @@ static int ceph_setattr_chmod(struct dentry *dentry, struct iattr *attr)
        }
        spin_unlock(&inode->i_lock);
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LCHMOD, dentry, NULL,
-                                      NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LCHMOD, USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        req->r_args.chmod.mode = cpu_to_le32(attr->ia_mode);
        ceph_release_caps(inode, CEPH_CAP_AUTH_RDCACHE);
        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
@@ -1340,10 +1347,10 @@ static int ceph_setattr_time(struct dentry *dentry, struct iattr *attr)
 
        spin_unlock(&inode->i_lock);
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LUTIME, dentry, NULL,
-                                      NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LUTIME, USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        ceph_encode_timespec(&req->r_args.utime.mtime, &attr->ia_mtime);
        ceph_encode_timespec(&req->r_args.utime.atime, &attr->ia_atime);
 
@@ -1398,10 +1405,11 @@ static int ceph_setattr_size(struct dentry *dentry, struct iattr *attr)
        }
        spin_unlock(&inode->i_lock);
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LTRUNCATE, dentry,
-                                      NULL, NULL, NULL, USE_AUTH_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LTRUNCATE,
+                                      USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        req->r_args.truncate.length = cpu_to_le64(attr->ia_size);
        req->r_args.truncate.old_length = cpu_to_le64(inode->i_size);
        //ceph_release_caps(inode, CEPH_CAP_FILE_RDCACHE);
@@ -1475,25 +1483,25 @@ int ceph_do_getattr(struct dentry *dentry, int mask)
 {
        struct ceph_client *client = ceph_sb_to_client(dentry->d_sb);
        struct ceph_mds_client *mdsc = &client->mdsc;
+       struct inode *inode = dentry->d_inode;
        struct ceph_mds_request *req;
        int err;
 
-       if (ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) {
+       if (ceph_snap(inode) == CEPH_SNAPDIR) {
                dout(30, "do_getattr dentry %p inode %p SNAPDIR\n", dentry,
-                    dentry->d_inode);
+                    inode);
                return 0;
        }
 
        dout(30, "do_getattr dentry %p inode %p mask %s\n", dentry,
-            dentry->d_inode, ceph_cap_string(mask));
-       if (ceph_caps_issued_mask(ceph_inode(dentry->d_inode), mask))
+            inode, ceph_cap_string(mask));
+       if (ceph_caps_issued_mask(ceph_inode(inode), mask))
                return 0;
 
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSTAT,
-                                      dentry, NULL, NULL, NULL,
-                                      USE_ANY_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSTAT, USE_ANY_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        req->r_args.stat.mask = cpu_to_le32(mask);
        err = ceph_mdsc_do_request(mdsc, NULL, req);
        ceph_mdsc_put_request(req);  /* will dput(dentry) */
@@ -1794,10 +1802,10 @@ int ceph_setxattr(struct dentry *dentry, const char *name,
 
        /* do request */
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSETXATTR,
-                                      dentry, NULL, NULL, NULL, USE_AUTH_MDS);
+                                      USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
-
+       req->r_inode = igrab(inode);
        req->r_args.setxattr.flags = cpu_to_le32(flags);
 
        req->r_request->pages = pages;
@@ -1838,10 +1846,10 @@ int ceph_removexattr(struct dentry *dentry, const char *name)
                return -EOPNOTSUPP;
 
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LRMXATTR,
-                                      dentry, NULL, NULL, NULL, USE_AUTH_MDS);
+                                      USE_AUTH_MDS);
        if (IS_ERR(req))
                return PTR_ERR(req);
-
+       req->r_inode = igrab(inode);
        ceph_release_caps(inode, CEPH_CAP_XATTR_RDCACHE);
        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
        ceph_mdsc_put_request(req);
index 55c992e49f058e650310e4b9278a258a441e3dd5..b9402164bdea50b6c71efc94288413770a9a64e2 100644 (file)
@@ -39,8 +39,10 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
                return -EFAULT;
 
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSETLAYOUT,
-                                      file->f_dentry, NULL, NULL, NULL,
                                       USE_AUTH_MDS);
+       if (IS_ERR(req))
+               return PTR_ERR(req);
+       req->r_inode = igrab(inode);
        req->r_args.setlayout.layout = layout;
        ceph_release_caps(inode, CEPH_CAP_FILE_RDCACHE);
        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
index aec27929b34921d464bee1f60f4a096ac6959eee..87a153f07e26d6c8f5f7d16e56bb1d5836d460c2 100644 (file)
@@ -358,6 +358,8 @@ void ceph_mdsc_put_request(struct ceph_mds_request *req)
                        ceph_msg_put(req->r_reply);
                        destroy_reply_info(&req->r_reply_info);
                }
+               if (req->r_inode)
+                       iput(req->r_inode);
                if (req->r_target_inode)
                        iput(req->r_target_inode);
                if (req->r_dentry)
@@ -782,9 +784,7 @@ void ceph_mdsc_flushed_all_caps(struct ceph_mds_client *mdsc,
  * Create an mds request.
  */
 struct ceph_mds_request *
-ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op,
-                        struct dentry *dentry, struct dentry *old_dentry,
-                        const char *path1, const char *path2, int mode)
+ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
 {
        struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS);
 
@@ -801,12 +801,6 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op,
        INIT_LIST_HEAD(&req->r_unsafe_item);
 
        req->r_op = op;
-       if (dentry)
-               req->r_dentry = dget(dentry);
-       if (old_dentry)
-               req->r_old_dentry = dget(old_dentry);
-       req->r_path1 = path1;
-       req->r_path2 = path2;
        req->r_direct_mode = mode;
        return req;
 }
@@ -914,8 +908,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
 {
        struct ceph_msg *msg;
        struct ceph_mds_request_head *head;
-       char *path1 = (char *)req->r_path1;
-       char *path2 = (char *)req->r_path2;
+       const char *path1 = req->r_path1;
+       const char *path2 = req->r_path2;
        u64 ino1 = 1, ino2 = 0;
        int pathlen1 = 0, pathlen2 = 0;
        int pathlen;
@@ -929,14 +923,21 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
        } else {
                if (path1)
                        pathlen1 = strlen(path1);
-               else if (req->r_dentry)
-                       path1 = ceph_mdsc_build_path(req->r_dentry, &pathlen1, &ino1,
-                                          mds);
+               else if (req->r_inode) {
+                       ino1 = ceph_ino(req->r_inode);
+               } else {
+                       path1 = req->r_dentry->d_name.name;
+                       pathlen1 = req->r_dentry->d_name.len;
+                       ino1 = ceph_ino(req->r_dentry->d_parent->d_inode);
+               }
+
                if (path2)
                        pathlen2 = strlen(path2);
-               else if (req->r_old_dentry)
-                       path2 = ceph_mdsc_build_path(req->r_old_dentry, &pathlen2, &ino2,
-                                          mds);
+               else if (req->r_old_dentry) {
+                       path2 = req->r_old_dentry->d_name.name;
+                       pathlen2 = req->r_old_dentry->d_name.len;
+                       ino2 = ceph_ino(req->r_old_dentry->d_parent->d_inode);
+               }
                pathlen = pathlen1 + pathlen2 + 2*(sizeof(u32) + sizeof(u64));
        }
 
@@ -975,10 +976,6 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
                if (path2)
                        dout(10, "create_request_message path2 %llx/%s\n",
                             ino2, path2);
-               if (req->r_dentry)
-                       kfree(path1);
-               if (req->r_old_dentry)
-                       kfree(path2);
        }
 
        BUG_ON(p != end);
@@ -1038,7 +1035,7 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
        dout(20, " r_locked_dir = %p\n", req->r_locked_dir);
        rhead->num_dentries_wanted = req->r_locked_dir ? 1:0;
 
-       if (req->r_target_inode)
+       if (req->r_target_inode && req->r_got_unsafe)
                rhead->ino = cpu_to_le64(ceph_ino(req->r_target_inode));
        else
                rhead->ino = 0;
index 8239ab00144708465c2d7b6cfa191fcf1f1f06ea..13e632fd03ab4ca2f0b9cc59d7fb2f5b97460a62 100644 (file)
@@ -155,11 +155,14 @@ struct ceph_mds_request {
        u64 r_tid;                   /* transaction id */
 
        int r_op;
+       struct inode *r_inode;
        struct dentry *r_dentry;
        struct dentry *r_old_dentry; /* rename from or link from */
        const char *r_path1, *r_path2;
        union ceph_mds_request_args r_args;
 
+       struct inode *r_target_inode;
+
        struct ceph_msg  *r_request;  /* original request */
        struct ceph_msg  *r_reply;
        struct ceph_mds_reply_info_parsed r_reply_info;
@@ -181,7 +184,6 @@ struct ceph_mds_request {
        /* references to the trailing dentry and inode from parsing the
         * mds response.  also used to feed a VFS-provided dentry into
         * the reply handler */
-       struct inode     *r_target_inode;
        int               r_fmode;        /* file mode, if expecting cap */
        struct ceph_mds_session *r_session;
        struct ceph_mds_session *r_fwd_session;  /* forwarded from */
@@ -285,10 +287,7 @@ extern void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc,
                                    struct dentry *dn, int mask);
 
 extern struct ceph_mds_request *
-ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op,
-                        struct dentry *dentry, struct dentry *old_dentry,
-                        const char *path1, const char *path2,
-                        int mode);
+ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
 extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
                                     struct ceph_mds_request *req);
 extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
index 216008cc9809289adc5e73ae20e6bbac9ed323fa..a4b67e0f844cd3227d6708b67c208ac5a5f1867c 100644 (file)
@@ -761,11 +761,10 @@ static struct dentry *open_root_dentry(struct ceph_client *client,
 
        /* open dir */
        dout(30, "open_root_inode opening '%s'\n", path);
-       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSTAT,
-                                      NULL, NULL, path, NULL,
-                                      USE_ANY_MDS);
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LSTAT, USE_ANY_MDS);
        if (IS_ERR(req))
                return ERR_PTR(PTR_ERR(req));
+       req->r_path1 = path;
        req->r_started = started;
        req->r_timeout = client->mount_args.mount_timeout * HZ;
        req->r_args.stat.mask = cpu_to_le32(CEPH_STAT_CAP_INODE);
index 931eb5eddd0804153ac4078fcba3c5ad812482a6..6a7f6ca8f319443970a3772537aff9dd3747da66 100644 (file)
@@ -5000,7 +5000,7 @@ void Server::handle_client_open(MDRequest *mdr)
     mds->balancer->hit_inode(mdr->now, cur, META_POP_IRD, 
                             mdr->client_request->get_orig_source().num());
   
-  reply_request(mdr, 0);
+  reply_request(mdr, 0, cur);
 }