summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-08-11 16:00:47 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-08-25 05:31:35 -0700
commit130697b8b706432153d9a0fda49b896065289aaa (patch)
tree3b63aceeb6644a4c2dd3210126a4a3a9f8835136
parentedcf4d35397a0a4843b3f6b107c44630c86f3d3c (diff)
libgfapi: adding 'follow' flag to glfs_h_lookupat()
This patch is backport of http://review.gluster.org/#/c/11883/ Previously glfs_h_lookupat won't follow the symlink, this patch introduces new flag `follow` which will resolve the same. Applications linking against the new library will need to use the new glfs_h_lookupat API call. In order to stay compatible with existing binaries that use the previous glfs_h_lookupat() function, the old symbol needs to stay available. Verification that there are two versions of glfs_h_lookupat: $ objdump -T /usr/lib64/libgfapi.so.0 | grep -w glfs_h_lookupat 0000000000015070 g DF .text 000000000000021e GFAPI_3.7.4 glfs_h_lookupat 0000000000015290 g DF .text 0000000000000008 (GFAPI_3.4.2) glfs_h_lookupat Testing with a binary (based on anonymous_fd_read_write.c from ./tests/) that was linked against the old library: $ objdump -T ./lookupat | grep -w glfs_h_lookupat 0000000000000000 DF *UND* 0000000000000000 GFAPI_3.4.2 glfs_h_lookupat Enable debugging for 'ld.so' so that we can check that the GFAPI_3.4.2 version of the symbol gets loaded: $ export LD_DEBUG_OUTPUT=lookupat.ld.log LD_DEBUG=all $ ./lookupat $ grep -w glfs_h_lookupat lookupat.ld.log.2543 2543: symbol=glfs_h_lookupat; lookup in file=./lookupat [0] 2543: symbol=glfs_h_lookupat; lookup in file=/lib64/libgfapi.so.0 [0] 2543: binding file ./lookupat [0] to /lib64/libgfapi.so.0 [0]: normal symbol `glfs_h_lookupat' [GFAPI_3.4.2] This change has been successfully cherry-picked as 1ead86a8bcbfe4045729466e4b98f765f3c13c8d in master Upstream reference >Change-Id: I8bf9b1c19a0585f681bc1a7f84aad1ccd0f75f6a >BUG: 1252410 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Signed-off-by: Niels de Vos <ndevos@redhat.com> >Reviewed-on: http://review.gluster.org/11883 >Reviewed-by: soumya k <skoduri@redhat.com> >Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: Idbbf0cd6802f86c53b16377d90d08ff6d99e7b08 BUG: 1256616 Reviewed-on: http://review.gluster.org/12009 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
-rw-r--r--api/examples/glfsxmp.c36
-rw-r--r--api/src/gfapi.aliases4
-rw-r--r--api/src/gfapi.map6
-rw-r--r--api/src/glfs-handleops.c15
-rw-r--r--api/src/glfs-handles.h8
-rw-r--r--doc/developer-guide/gfapi-symbol-versions/gfapi-symbol-versions.md2
-rw-r--r--tests/basic/gfapi/anonymous_fd_read_write.c2
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c2
8 files changed, 45 insertions, 30 deletions
diff --git a/api/examples/glfsxmp.c b/api/examples/glfsxmp.c
index 7180a997f13..7ff3f0eb7ee 100644
--- a/api/examples/glfsxmp.c
+++ b/api/examples/glfsxmp.c
@@ -216,7 +216,7 @@ test_h_unlink (void)
printf ("glfs_h_unlink tests: In Progress\n");
/* Prepare tests */
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -350,7 +350,7 @@ test_h_getsetattrs (void)
printf("glfs_h_getattrs and setattrs tests: In Progress\n");
/* Prepare tests */
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -447,7 +447,7 @@ test_h_truncate (void)
printf("glfs_h_truncate tests: In Progress\n");
/* Prepare tests */
- root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -585,7 +585,7 @@ test_h_links (void)
printf("glfs_h_link(s) tests: In Progress\n");
/* Prepare tests */
- root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -729,7 +729,7 @@ test_h_rename (void)
printf("glfs_h_rename tests: In Progress\n");
/* Prepare tests */
- root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ root = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -904,7 +904,7 @@ test_h_performance (void)
printf("glfs_h_performance tests: In Progress\n");
/* Prepare tests */
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, NULL, strerror (errno));
@@ -940,7 +940,7 @@ test_h_performance (void)
goto out;
}
- leaf = glfs_h_lookupat (fs, dir, my_file_name, &sb);
+ leaf = glfs_h_lookupat (fs, dir, my_file_name, &sb, 0);
if (leaf != NULL) {
fprintf (stderr, "glfs_h_lookup: exists %s\n",
my_file_name);
@@ -1114,7 +1114,7 @@ test_handleops (int argc, char *argv[])
/* glfs_lookupat test */
printf ("glfs_h_lookupat tests: In Progress\n");
/* start at root of the volume */
- root = glfs_h_lookupat (fs, NULL, "/", &sb);
+ root = glfs_h_lookupat (fs, NULL, "/", &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
"/", NULL, strerror (errno));
@@ -1124,7 +1124,7 @@ test_handleops (int argc, char *argv[])
peek_stat (&sb);
/* lookup a parent within root */
- parent = glfs_h_lookupat (fs, root, parent_name, &sb);
+ parent = glfs_h_lookupat (fs, root, parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
parent_name, root, strerror (errno));
@@ -1134,7 +1134,7 @@ test_handleops (int argc, char *argv[])
peek_stat (&sb);
/* lookup a leaf/child within the parent */
- leaf = glfs_h_lookupat (fs, parent, leaf_name, &sb);
+ leaf = glfs_h_lookupat (fs, parent, leaf_name, &sb, 0);
if (leaf == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
leaf_name, parent, strerror (errno));
@@ -1149,7 +1149,7 @@ test_handleops (int argc, char *argv[])
glfs_h_close (parent); parent = NULL;
/* check absolute paths */
- root = glfs_h_lookupat (fs, NULL, "/", &sb);
+ root = glfs_h_lookupat (fs, NULL, "/", &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
"/", NULL, strerror (errno));
@@ -1158,7 +1158,7 @@ test_handleops (int argc, char *argv[])
}
peek_stat (&sb);
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, root, strerror (errno));
@@ -1167,7 +1167,7 @@ test_handleops (int argc, char *argv[])
}
peek_stat (&sb);
- leaf = glfs_h_lookupat (fs, NULL, full_leaf_name, &sb);
+ leaf = glfs_h_lookupat (fs, NULL, full_leaf_name, &sb, 0);
if (leaf == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_leaf_name, parent, strerror (errno));
@@ -1180,7 +1180,7 @@ test_handleops (int argc, char *argv[])
glfs_h_close (leaf); leaf = NULL;
/* check multiple component paths */
- leaf = glfs_h_lookupat (fs, root, relative_leaf_name, &sb);
+ leaf = glfs_h_lookupat (fs, root, relative_leaf_name, &sb, 0);
if (leaf == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
relative_leaf_name, parent, strerror (errno));
@@ -1236,7 +1236,7 @@ test_handleops (int argc, char *argv[])
/* Create tests */
printf ("glfs_h_creat tests: In Progress\n");
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, root, strerror (errno));
@@ -1284,7 +1284,7 @@ test_handleops (int argc, char *argv[])
printf ("glfs_h_extract_handle and glfs_h_create_from_handle tests: In Progress\n");
/* TODO: Change the lookup to creat below for a GIFD recovery falure,
* that needs to be fixed */
- leaf = glfs_h_lookupat (fs, parent, leaf_name1, &sb);
+ leaf = glfs_h_lookupat (fs, parent, leaf_name1, &sb, 0);
if (leaf == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
leaf_name1, parent, strerror (errno));
@@ -1355,7 +1355,7 @@ test_handleops (int argc, char *argv[])
goto out;
}
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, root, strerror (errno));
@@ -1399,7 +1399,7 @@ test_handleops (int argc, char *argv[])
goto out;
}
- parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb);
+ parent = glfs_h_lookupat (fs, NULL, full_parent_name, &sb, 0);
if (parent == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of %s: from (%p),%s\n",
full_parent_name, root, strerror (errno));
diff --git a/api/src/gfapi.aliases b/api/src/gfapi.aliases
index 9776c87fdcb..40b6ed21192 100644
--- a/api/src/gfapi.aliases
+++ b/api/src/gfapi.aliases
@@ -89,7 +89,7 @@ _pub_glfs_dup _glfs_dup$GFAPI_3.4.0
_pub_glfs_setfsuid _glfs_setfsuid$GFAPI_3.4.2
_pub_glfs_setfsgid _glfs_setfsgid$GFAPI_3.4.2
_pub_glfs_setfsgroups _glfs_setfsgroups$GFAPI_3.4.2
-_pub_glfs_h_lookupat _glfs_h_lookupat$GFAPI_3.4.2
+_pub_glfs_h_lookupat34 _glfs_h_lookupat$GFAPI_3.4.2
_pub_glfs_h_creat _glfs_h_creat$GFAPI_3.4.2
_pub_glfs_h_mkdir _glfs_h_mkdir$GFAPI_3.4.2
_pub_glfs_h_mknod _glfs_h_mknod$GFAPI_3.4.2
@@ -138,3 +138,5 @@ _priv_glfs_free_from_ctx _glfs_free_from_ctx$GFAPI_PRIVATE_3.7.0
_priv_glfs_new_from_ctx _glfs_new_from_ctx$GFAPI_PRIVATE_3.7.0
_priv_glfs_resolve _glfs_resolve$GFAPI_PRIVATE_3.7.0
_priv_glfs_process_upcall_event _glfs_process_upcall_event$GFAPI_PRIVATE_3.7.0
+
+_pub_glfs_h_lookupat _glfs_h_lookupat$GFAPI_3.7.4
diff --git a/api/src/gfapi.map b/api/src/gfapi.map
index 48863985135..d42ae2b97af 100644
--- a/api/src/gfapi.map
+++ b/api/src/gfapi.map
@@ -98,7 +98,6 @@ GFAPI_3.4.2 {
glfs_setfsuid;
glfs_setfsgid;
glfs_setfsgroups;
- glfs_h_lookupat;
glfs_h_creat;
glfs_h_mkdir;
glfs_h_mknod;
@@ -163,3 +162,8 @@ GFAPI_PRIVATE_3.7.0 {
glfs_resolve;
glfs_process_upcall_event;
} GFAPI_3.7.0;
+
+GFAPI_3.7.4 {
+ global:
+ glfs_h_lookupat;
+} GFAPI_PRIVATE_3.7.0;
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c
index 2e552b763dc..79085ff33a1 100644
--- a/api/src/glfs-handleops.c
+++ b/api/src/glfs-handleops.c
@@ -63,7 +63,7 @@ glfs_iatt_from_stat (struct stat *stat, int valid, struct iatt *iatt,
struct glfs_object *
pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,
- const char *path, struct stat *stat)
+ const char *path, struct stat *stat, int follow)
{
int ret = 0;
xlator_t *subvol = NULL;
@@ -100,7 +100,7 @@ pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,
/* fop/op */
ret = glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt,
- 0 /*TODO: links? */, 0);
+ follow, 0);
/* populate out args */
if (!ret) {
@@ -124,7 +124,16 @@ invalid_fs:
return object;
}
-GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_lookupat, 3.4.2);
+GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_lookupat, 3.7.4);
+
+struct glfs_object *
+pub_glfs_h_lookupat34 (struct glfs *fs, struct glfs_object *parent,
+ const char *path, struct stat *stat)
+{
+ return pub_glfs_h_lookupat (fs, parent, path, stat, 0);
+}
+
+GFAPI_SYMVER_PUBLIC(glfs_h_lookupat34, glfs_h_lookupat, 3.4.2);
int
pub_glfs_h_statfs (struct glfs *fs, struct glfs_object *object,
diff --git a/api/src/glfs-handles.h b/api/src/glfs-handles.h
index 19c4e8f7a62..71bd21ff98c 100644
--- a/api/src/glfs-handles.h
+++ b/api/src/glfs-handles.h
@@ -153,10 +153,10 @@ enum gfapi_callback_type {
/* Handle based operations */
/* Operations that generate handles */
struct glfs_object *glfs_h_lookupat (struct glfs *fs,
- struct glfs_object *parent,
- const char *path,
- struct stat *stat) __THROW
- GFAPI_PUBLIC(glfs_h_lookupat, 3.4.0);
+ struct glfs_object *parent,
+ const char *path,
+ struct stat *stat, int follow) __THROW
+ GFAPI_PUBLIC(glfs_h_lookupat, 3.7.4);
struct glfs_object *glfs_h_creat (struct glfs *fs, struct glfs_object *parent,
const char *path, int flags, mode_t mode,
diff --git a/doc/developer-guide/gfapi-symbol-versions/gfapi-symbol-versions.md b/doc/developer-guide/gfapi-symbol-versions/gfapi-symbol-versions.md
index e4f4fe9f052..c7a3ac9380e 100644
--- a/doc/developer-guide/gfapi-symbol-versions/gfapi-symbol-versions.md
+++ b/doc/developer-guide/gfapi-symbol-versions/gfapi-symbol-versions.md
@@ -29,7 +29,7 @@ file remains libfoo.so.0 forever. Legacy APIs may or may not have an
associated symbol version. New APIs may or may not have an associated
symbol version either. In general symbol versions are reserved for APIs
that have changed. Either the function's signature has changed, i.e. the
-return time or the number of paramaters, and/or the parameter types have
+return type or the number of paramaters, and/or the parameter types have
changed. Another reason for using symbol versions on an API is when the
behaviour or functionality of the API changes dramatically. As with a
library that doesn't use versioned symbols, old and new applications
diff --git a/tests/basic/gfapi/anonymous_fd_read_write.c b/tests/basic/gfapi/anonymous_fd_read_write.c
index 281184e8223..885f0a2b26f 100644
--- a/tests/basic/gfapi/anonymous_fd_read_write.c
+++ b/tests/basic/gfapi/anonymous_fd_read_write.c
@@ -54,7 +54,7 @@ main (int argc, char *argv[])
ret = glfs_init (fs);
LOG_ERR("glfs_init", ret);
- root = glfs_h_lookupat (fs, NULL, "/", &sb);
+ root = glfs_h_lookupat (fs, NULL, "/", &sb, 0);
if (root == NULL) {
fprintf (stderr, "glfs_h_lookupat: error on lookup of / ,%s\n",
strerror (errno));
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 3415ce0d671..5ae96251ce0 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -293,7 +293,7 @@ svs_lookup_entry (xlator_t *this, loc_t *loc, struct iatt *buf,
fs = parent_ctx->fs;
object = glfs_h_lookupat (fs, parent_object, loc->name,
- &statbuf);
+ &statbuf, 0);
if (!object) {
gf_log (this->name, GF_LOG_DEBUG, "failed to do lookup and "
"get the handle for entry %s (path: %s)", loc->name,