diff options
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 30 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 5 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.h | 2 | 
3 files changed, 32 insertions, 5 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 04c166c54f7..f4334302f27 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);  } - diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 2452ddc4d88..0987075e1f5 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -60,6 +60,7 @@  #include "glusterfs3-xdr.h"  #include "hashfn.h" +extern char *marker_xattrs[];  #undef HAVE_SET_FSID  #ifdef HAVE_SET_FSID @@ -3101,7 +3102,9 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,                                                              this->name,GF_LOG_WARNING,                                                              "Extended attributes not "                                                              "supported by filesystem"); -                                } else  { +                                } else if (op_errno != ENOENT || +                                           !posix_special_xattr (marker_xattrs, +                                                                 trav->key)) {                                          if (loc)                                                  gf_log (this->name, GF_LOG_ERROR,                                                          "getxattr failed on %s while doing " diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index c551ffc1abd..7c2b47bb02b 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -54,7 +54,6 @@  #include "posix-mem-types.h"  #include "posix-handle.h" -  /**   * posix_fd - internal structure common to file and directory fd's   */ @@ -159,4 +158,5 @@ int posix_fd_ctx_get_off (fd_t *fd, xlator_t *this, struct posix_fd **pfd,                            off_t off);  void posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf); +gf_boolean_t posix_special_xattr (char **pattern, char *key);  #endif /* _POSIX_H */  | 
