From: Sage Weil Date: Tue, 23 Jun 2009 03:18:58 +0000 (-0700) Subject: kclient: make r_path[12] dup strings X-Git-Tag: v0.10~178 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=299eddaac39d5e12b50b7e57cfa82ef66d882c99;p=ceph.git kclient: make r_path[12] dup strings 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. --- diff --git a/src/kernel/dir.c b/src/kernel/dir.c index aa22286e25c2..4c983a59bb09 100644 --- a/src/kernel/dir.c +++ b/src/kernel/dir.c @@ -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; diff --git a/src/kernel/export.c b/src/kernel/export.c index 50482f992e3c..6ec1629cfc6a 100644 --- a/src/kernel/export.c +++ b/src/kernel/export.c @@ -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); diff --git a/src/kernel/inode.c b/src/kernel/inode.c index 06b062d3605e..149d5b402cb9 100644 --- a/src/kernel/inode.c +++ b/src/kernel/inode.c @@ -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); diff --git a/src/kernel/mds_client.c b/src/kernel/mds_client.c index 4dccb4a46f91..8cb0a3ca3712 100644 --- a/src/kernel/mds_client.c +++ b/src/kernel/mds_client.c @@ -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); diff --git a/src/kernel/super.c b/src/kernel/super.c index d39f8e4c8962..1a1193580633 100644 --- a/src/kernel/super.c +++ b/src/kernel/super.c @@ -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;