summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-10-29 01:03:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-28 23:42:13 -0700
commit9a62a3747cfcef2db3bc0b630a92f24d9436eeca (patch)
tree2fea3023214a5783170c8a8828724231b0049e3f
parentb3b4fc4afb7d206d0a481f3234bf83c768f02aa2 (diff)
posix: posix_[f]setattr() handle valid=0 case by performing {f, l}chown (-1, -1)
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 146 (Add setattr FOP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
-rw-r--r--xlators/storage/posix/src/posix.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 82462db95..b901b673f 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -652,6 +652,18 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
}
}
+ if (!valid) {
+ op_ret = lchown (real_path, -1, -1);
+ if (op_ret == -1) {
+ op_errno = errno;
+ gf_log (this->name, GF_LOG_ERROR,
+ "lchown (%s, -1, -1) failed => (%s)",
+ real_path, strerror (op_errno));
+
+ goto out;
+ }
+ }
+
op_ret = posix_lstat_with_gen (this, real_path, &statpost);
if (op_ret == -1) {
op_errno = errno;
@@ -782,6 +794,18 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
}
}
+ if (!valid) {
+ op_ret = fchown (pfd->fd, -1, -1);
+ if (op_ret == -1) {
+ op_errno = errno;
+ gf_log (this->name, GF_LOG_ERROR,
+ "fchown (%d, -1, -1) failed => (%s)",
+ pfd->fd, strerror (op_errno));
+
+ goto out;
+ }
+ }
+
op_ret = posix_fstat_with_gen (this, pfd->fd, &statpost);
if (op_ret == -1) {
op_errno = errno;