From 9a62a3747cfcef2db3bc0b630a92f24d9436eeca Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 29 Oct 2009 01:03:09 +0000 Subject: posix: posix_[f]setattr() handle valid=0 case by performing {f, l}chown (-1, -1) Signed-off-by: Anand V. Avati BUG: 146 (Add setattr FOP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146 --- xlators/storage/posix/src/posix.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xlators/storage') 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; -- cgit