]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: make r_path[12] dup strings
authorSage Weil <sage@newdream.net>
Tue, 23 Jun 2009 03:18:58 +0000 (20:18 -0700)
committerSage Weil <sage@newdream.net>
Tue, 23 Jun 2009 03:21:58 +0000 (20:21 -0700)
The mds_request lifetime differs from the caller's stack, so we need to
duplicate these strings.  Fixes problems with request reply after MDS
recovery.

src/kernel/dir.c
src/kernel/export.c
src/kernel/inode.c
src/kernel/mds_client.c
src/kernel/super.c

index aa22286e25c247f8b77ca9c80e320b725a47a3ad..4c983a59bb0976f17bbab617e9e4c64ed125cc3a 100644 (file)
@@ -241,7 +241,7 @@ more:
                req->r_direct_mode = USE_AUTH_MDS;
                req->r_direct_hash = frag_value(frag);
                req->r_direct_is_hash = true;
-               req->r_path2 = fi->last_name;
+               req->r_path2 = kstrdup(fi->last_name, GFP_NOFS);
                req->r_readdir_offset = fi->next_offset;
                req->r_args.readdir.frag = cpu_to_le32(frag);
                req->r_args.readdir.max_entries = cpu_to_le32(max_entries);
@@ -605,7 +605,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
        }
        req->r_dentry = dget(dentry);
        req->r_num_caps = 2;
-       req->r_path2 = dest;
+       req->r_path2 = kstrdup(dest, GFP_NOFS);
        req->r_locked_dir = dir;
        req->r_dentry_drop = CEPH_CAP_FILE_SHARED;
        req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
index 50482f992e3ce13b95a42a1a461f90b0e4e0fc2d..6ec1629cfc6a5d855b6eaf437c800e84a2c358ba 100644 (file)
@@ -93,10 +93,8 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
                if (IS_ERR(req))
                        return ERR_PTR(PTR_ERR(req));
 
-               req->r_path1 = "";
                req->r_ino1 = fh->ino;
                snprintf(path2, BUF_SIZE, "%d", hash);
-               req->r_path2 = "";
                req->r_ino2 = fh->parent_ino;
                req->r_num_caps = 1;
                err = ceph_mdsc_do_request(mdsc, NULL, req);
index 06b062d3605e8d55c1ba88f54b34ef7dbda3515c..149d5b402cb98b708a3360f745475ce403fffa7c 100644 (file)
@@ -2177,7 +2177,7 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
        req->r_inode_drop = CEPH_CAP_XATTR_SHARED;
        req->r_num_caps = 1;
        req->r_args.setxattr.flags = cpu_to_le32(flags);
-       req->r_path2 = name;
+       req->r_path2 = kstrdup(name, GFP_NOFS);
 
        req->r_pages = pages;
        req->r_num_pages = nr_pages;
@@ -2308,7 +2308,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name)
        req->r_inode = igrab(inode);
        req->r_inode_drop = CEPH_CAP_XATTR_SHARED;
        req->r_num_caps = 1;
-       req->r_path2 = name;
+       req->r_path2 = kstrdup(name, GFP_NOFS);
 
        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
        ceph_mdsc_put_request(req);
index 4dccb4a46f914d3749f4f26cb3d7df5dfcd8d23c..8cb0a3ca37122717408e645111390c038f5096bd 100644 (file)
@@ -381,6 +381,8 @@ void ceph_mdsc_put_request(struct ceph_mds_request *req)
                                          CEPH_CAP_PIN);
                        dput(req->r_old_dentry);
                }
+               kfree(req->r_path1);
+               kfree(req->r_path2);
                put_request_sessions(req);
                ceph_unreserve_caps(&req->r_caps_reservation);
                kfree(req);
index d39f8e4c8962e56ad838e808697038303dcf16f7..1a119358063365fdaa84b98a9d53aee22aa17d15 100644 (file)
@@ -768,7 +768,7 @@ static struct dentry *open_root_dentry(struct ceph_client *client,
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GETATTR, USE_ANY_MDS);
        if (IS_ERR(req))
                return ERR_PTR(PTR_ERR(req));
-       req->r_path1 = path;
+       req->r_path1 = kstrdup(path, GFP_NOFS);
        req->r_ino1.ino = CEPH_INO_ROOT;
        req->r_ino1.snap = CEPH_NOSNAP;
        req->r_started = started;