diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-01-21 13:49:08 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-01-21 13:49:08 +0000 |
commit | 6bcbf03b5aa4448832645a29ec2bc4b2fc5f2eaf (patch) | |
tree | 750f73a40aa62c20d66a2532fef6fd158cebb9c4 /api/src/glfs-internal.h | |
parent | 0225d7bc712609232d592d48116ec771cd97c2cf (diff) | |
parent | 17c4fb2d04f84b5632983866e8bddfbd7d77a054 (diff) |
Merge branch 'upstream'
Conflicts:
api/src/glfs-fops.c
api/src/glfs-handleops.c
Change-Id: I6811674cc4ec4be6fa6e4cdebb4bc428194bebd8
Diffstat (limited to 'api/src/glfs-internal.h')
-rw-r--r-- | api/src/glfs-internal.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index ec1d5579d..f04557323 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -18,6 +18,26 @@ #define DEFAULT_REVAL_COUNT 1 +/* + * syncop_xxx() calls are executed in two ways, one is inside a synctask where + * the executing function will do 'swapcontext' and the other is without + * synctask where the executing thread is made to wait using pthread_cond_wait. + * Executing thread may change when syncop_xxx() is executed inside a synctask. + * This leads to errno_location change i.e. errno may give errno of + * non-executing thread. So errno is not touched inside a synctask execution. + * All gfapi calls are executed using the second way of executing syncop_xxx() + * where the executing thread waits using pthread_cond_wait so it is ok to set + * errno in these cases. The following macro makes syncop_xxx() behave just + * like a system call, where -1 is returned and errno is set when a failure + * occurs. + */ +#define DECODE_SYNCOP_ERR(ret) do { \ + if (ret < 0) { \ + errno = -ret; \ + ret = -1; \ + } \ + } while (0) + #define ESTALE_RETRY(ret,errno,reval,loc,label) do { \ if (ret == -1 && errno == ESTALE) { \ if (reval < DEFAULT_REVAL_COUNT) { \ |