diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-03-04 14:42:40 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-03-04 14:42:40 +0000 |
commit | 0de07f4189cbd191a765c60ed3d7c72f72112e68 (patch) | |
tree | 83781a0df06c9110c6f3db12caad23ea00832b53 /libglusterfs/src | |
parent | c28972ea53cc7cdb91c7aac01754dd7f0b66e1a7 (diff) | |
parent | 9f45d0f6212d6d5c96dafc4aba73d9d12b39c3d6 (diff) |
Merge branch 'upstream' into merge
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Conflicts:
api/src/glfs-fops.c
libglusterfs/src/syncop.c
libglusterfs/src/syncop.h
Change-Id: I8c3fa7a20fb167d9e6bc2749e177c0c8b366827b
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/common-utils.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 346 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 137 | ||||
-rw-r--r-- | libglusterfs/src/inode.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/logging.c | 7 | ||||
-rw-r--r-- | libglusterfs/src/syncop.c | 46 | ||||
-rw-r--r-- | libglusterfs/src/syncop.h | 17 |
7 files changed, 547 insertions, 13 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index e3b019b9e..f877590f4 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -115,7 +115,8 @@ typedef int (*gf_cmp) (void *, void *); void gf_global_variable_init(void); -in_addr_t gf_resolve_ip (const char *hostname, void **dnscache); +int32_t gf_resolve_ip6 (const char *hostname, uint16_t port, int family, + void **dnscache, struct addrinfo **addr_info); void gf_log_dump_graph (FILE *specfp, glusterfs_graph_t *graph); void gf_print_trace (int32_t signal, glusterfs_ctx_t *ctx); diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index e6b1287f9..f5fb2aa9d 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -27,6 +27,352 @@ #include "xlator.h" +/* FAILURE_CBK function section */ + +int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (stat, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (truncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (access, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mknod, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mkdir, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (unlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rmdir, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (symlink, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rename, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (link, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (create, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (open, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readv, frame, -1, op_errno, NULL, -1, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (flush, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsync, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fstat, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (opendir, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsyncdir, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (statfs, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setxattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetxattr, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fgetxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (xattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fxattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (removexattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lk, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (inodelk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (finodelk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (entrylk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fentrylk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rchecksum, frame, -1, op_errno, -1, NULL, NULL); + return 0; +} + + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdir, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdirp, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(fallocate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(discard, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(zerofill, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getspec, frame, -1, op_errno, NULL); + return 0; +} + /* _CBK function section */ int32_t diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 0fb5572ac..f0b786ddf 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -718,6 +718,143 @@ default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, char *spec_data); int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t default_mem_acct_init (xlator_t *this); #endif /* _DEFAULTS_H */ diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 15e0ccf78..d4eade8ba 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1599,7 +1599,7 @@ __inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, &tmp_value, NULL); - if (!ret) + if (!ret && value1) *value1 = tmp_value; return ret; @@ -1612,7 +1612,7 @@ __inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, NULL, &tmp_value); - if (!ret) + if (!ret && value2) *value2 = tmp_value; return ret; diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 0058233a7..2bd40b2c2 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -138,6 +138,7 @@ gf_log_fini (void *data) call to gf_log after calling gf_log_fini, will log the message to stderr. */ + ctx->log.loglevel = GF_LOG_NONE; ctx->log.logfile = NULL; } } @@ -556,7 +557,7 @@ _gf_log_nomem (const char *domain, const char *file, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -711,7 +712,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -880,7 +881,7 @@ log: if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); fflush (ctx->log.logfile); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); fflush (stderr); } diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 219fbc842..552a26355 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -169,6 +169,46 @@ out: return ret; } +int +syncopctx_setfspid (void *pid) +{ + struct syncopctx *opctx = NULL; + int ret = 0; + + /* In args check */ + if (!pid) { + ret = -1; + errno = EINVAL; + goto out; + } + + opctx = syncopctx_getctx (); + + /* alloc for this thread the first time */ + if (!opctx) { + opctx = GF_CALLOC (1, sizeof (*opctx), gf_common_mt_syncopctx); + if (!opctx) { + ret = -1; + goto out; + } + + ret = syncopctx_setctx (opctx); + if (ret != 0) { + GF_FREE (opctx); + opctx = NULL; + goto out; + } + } + +out: + if (opctx && pid) { + opctx->pid = *(pid_t *)pid; + opctx->valid |= SYNCOPCTX_PID; + } + + return ret; +} + static void __run (struct synctask *task) { @@ -1224,7 +1264,7 @@ syncop_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name) +syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name, dict_t *xdata) { return(syncop_removexattr_with_xdata(subvol, loc, name, NULL)); } @@ -1259,12 +1299,12 @@ syncop_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name) +syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name, dict_t *xdata) { struct syncargs args = {0, }; SYNCOP (subvol, (&args), syncop_fremovexattr_cbk, - subvol->fops->fremovexattr, fd, name, NULL); + subvol->fops->fremovexattr, fd, name, xdata); if (args.op_ret < 0) return -args.op_errno; diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 87985588f..fb867a108 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -31,6 +31,7 @@ #define SYNCOPCTX_UID 0x00000001 #define SYNCOPCTX_GID 0x00000002 #define SYNCOPCTX_GROUPS 0x00000004 +#define SYNCOPCTX_PID 0x00000008 struct synctask; struct syncproc; @@ -164,6 +165,7 @@ struct syncopctx { int grpsize; int ngrps; gid_t *groups; + pid_t pid; }; #define __yawn(args) do { \ @@ -260,6 +262,7 @@ int synctask_setid (struct synctask *task, uid_t uid, gid_t gid); int syncopctx_setfsuid (void *uid); int syncopctx_setfsgid (void *gid); int syncopctx_setfsgroups (int count, const void *groups); +int syncopctx_setfspid (void *pid); static inline call_frame_t * syncop_create_frame (xlator_t *this) @@ -272,9 +275,13 @@ syncop_create_frame (xlator_t *this) if (!frame) return NULL; - frame->root->pid = getpid (); - opctx = syncopctx_getctx (); + + if (opctx && (opctx->valid & SYNCOPCTX_PID)) + frame->root->pid = opctx->pid; + else + frame->root->pid = getpid (); + if (opctx && (opctx->valid & SYNCOPCTX_UID)) frame->root->uid = opctx->uid; else @@ -372,9 +379,11 @@ int syncop_listxattr (xlator_t *subvol, loc_t *loc, dict_t **dict); int syncop_getxattr (xlator_t *xl, loc_t *loc, dict_t **dict, const char *key); int syncop_fgetxattr (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key); int syncop_fgetxattr_with_xdata (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key, dict_t *extra); -int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name); +int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name, + dict_t *xdata); int syncop_removexattr_with_xdata (xlator_t *subvol, loc_t *loc, const char *name, dict_t *dict); -int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name); +int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name, + dict_t *xdata); int syncop_fremovexattr_with_xdata (xlator_t *subvol, fd_t *fd, const char *name, dict_t *dict); int syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode, |