diff options
author | Poornima G <pgurusid@redhat.com> | 2016-07-29 12:20:11 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-08-04 08:46:44 -0700 |
commit | 5ae0a5d1e92175c28cd5470b890e99ff4eac0673 (patch) | |
tree | 2654eceb637d64e73897bbb88b081ff277a25f9e /libglusterfs/src | |
parent | 2650f8b1101a1f345f310475841569feb852bf4b (diff) |
md-cache/upcall: In case of mode bit change invalidate xattr
When the mode bits are changed, the ACL entries also do get affected.
Currently in upcall, setattr invalidates only the stat info.
With this patch, if mode bits are changed, the upcall will invalidate
all the xattrs.
Change-Id: Iccda2e1a7440ee845aa5442bf51970f74d9b0862
BUG: 1211863
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/15043
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/iatt.h | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/libglusterfs/src/iatt.h b/libglusterfs/src/iatt.h index e89f94662aa..2b2f7b9e503 100644 --- a/libglusterfs/src/iatt.h +++ b/libglusterfs/src/iatt.h @@ -174,6 +174,43 @@ ia_type_from_st_mode (mode_t mode) } +static inline uint32_t +st_mode_prot_from_ia (ia_prot_t prot) +{ + uint32_t prot_bit = 0; + + if (prot.suid) + prot_bit |= S_ISUID; + if (prot.sgid) + prot_bit |= S_ISGID; + if (prot.sticky) + prot_bit |= S_ISVTX; + + if (prot.owner.read) + prot_bit |= S_IRUSR; + if (prot.owner.write) + prot_bit |= S_IWUSR; + if (prot.owner.exec) + prot_bit |= S_IXUSR; + + if (prot.group.read) + prot_bit |= S_IRGRP; + if (prot.group.write) + prot_bit |= S_IWGRP; + if (prot.group.exec) + prot_bit |= S_IXGRP; + + if (prot.other.read) + prot_bit |= S_IROTH; + if (prot.other.write) + prot_bit |= S_IWOTH; + if (prot.other.exec) + prot_bit |= S_IXOTH; + + return prot_bit; +} + + static inline mode_t st_mode_from_ia (ia_prot_t prot, ia_type_t type) { @@ -207,33 +244,7 @@ st_mode_from_ia (ia_prot_t prot, ia_type_t type) break; } - if (prot.suid) - prot_bit |= S_ISUID; - if (prot.sgid) - prot_bit |= S_ISGID; - if (prot.sticky) - prot_bit |= S_ISVTX; - - if (prot.owner.read) - prot_bit |= S_IRUSR; - if (prot.owner.write) - prot_bit |= S_IWUSR; - if (prot.owner.exec) - prot_bit |= S_IXUSR; - - if (prot.group.read) - prot_bit |= S_IRGRP; - if (prot.group.write) - prot_bit |= S_IWGRP; - if (prot.group.exec) - prot_bit |= S_IXGRP; - - if (prot.other.read) - prot_bit |= S_IROTH; - if (prot.other.write) - prot_bit |= S_IWOTH; - if (prot.other.exec) - prot_bit |= S_IXOTH; + prot_bit = st_mode_prot_from_ia (prot); st_mode = (type_bit | prot_bit); @@ -323,5 +334,16 @@ iatt_to_stat (struct iatt *iatt, struct stat *stat) return 0; } +static inline int +is_same_mode (ia_prot_t prot1, ia_prot_t prot2) +{ + int ret = 0; + + if (st_mode_prot_from_ia(prot1) != st_mode_prot_from_ia(prot2)) + ret = -1; + + return ret; +} + #endif /* _IATT_H */ |