diff options
author | Mohammed Junaid <junaid@redhat.com> | 2012-04-09 12:14:59 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-04-09 10:37:44 -0700 |
commit | 4bb82b2c779bb984a980e371c3119254cf1cb0f8 (patch) | |
tree | 46b8b2475c83fdcb9d4917f7cffc8fcfbd1f52c1 /xlators/storage/posix/src/posix-helpers.c | |
parent | 05a9780c9111396f4e2c3ebdae77cf8a257f1a54 (diff) |
storage/posix: Avoid excessive logging in posix.
When quota or gsyncd is enabled, the marker translator performs setxattr on
files/directories. If the file/directory is deleted before setxattr, posix gets
an error when it does setxattr and logs it. But its not an error for marker and
it handles the case gracefully. Hence, avoid logging for these keys.
Change-Id: Ic614777399497be92ed1c2b4718d46adfb639d96
BUG: 765498
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.com/3105
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 04c166c54..f4334302f 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -54,7 +54,7 @@ #include "timer.h" #include "glusterfs3-xdr.h" #include "hashfn.h" - +#include <fnmatch.h> typedef struct { xlator_t *this; @@ -64,6 +64,10 @@ typedef struct { loc_t *loc; } posix_xattr_filler_t; +char *marker_xattrs[] = {"trusted.glusterfs.quota.*", + "trusted.glusterfs.*.xtime", + NULL}; + static char* posix_ignore_xattrs[] = { "gfid-req", GLUSTERFS_ENTRYLK_COUNT, @@ -72,6 +76,25 @@ static char* posix_ignore_xattrs[] = { NULL }; +gf_boolean_t +posix_special_xattr (char **pattern, char *key) +{ + int i = 0; + gf_boolean_t flag = _gf_false; + + GF_VALIDATE_OR_GOTO ("posix", pattern, out); + GF_VALIDATE_OR_GOTO ("posix", key, out); + + for (i = 0; pattern[i]; i++) { + if (!fnmatch (pattern[i], key, 0)) { + flag = _gf_true; + break; + } + } +out: + return flag; +} + static gf_boolean_t posix_xattr_ignorable (char *key, posix_xattr_filler_t *filler) { @@ -638,7 +661,9 @@ posix_handle_pair (xlator_t *this, const char *real_path, this->name,GF_LOG_WARNING, "Extended attributes not " "supported"); - } else if (errno == ENOENT) { + } else if (errno == ENOENT && + !posix_special_xattr (marker_xattrs, + trav->key)) { gf_log (this->name, GF_LOG_ERROR, "setxattr on %s failed: %s", real_path, strerror (errno)); @@ -1023,4 +1048,3 @@ posix_fd_ctx_get_off (fd_t *fd, xlator_t *this, struct posix_fd **pfd, { return posix_fd_ctx_get (fd, this, pfd); } - |