summaryrefslogtreecommitdiffstats
path: root/gluster/swift/common/fs_utils.py
diff options
context:
space:
mode:
authorMohammed Junaid <junaid@redhat.com>2013-06-25 07:50:28 +0530
committerPeter Portante <pportant@redhat.com>2013-06-27 17:15:45 -0700
commitc7ce3beec168cfc530da9e8d11fc1a0e8c80bcce (patch)
tree79100a6d0bc58a219f2c5784033fb7cff7276db6 /gluster/swift/common/fs_utils.py
parent41b91061436210afd1d22cad3c2ee1e038c23e3c (diff)
object-storage: Use fchown instead of chown.
This is a step towards making fd based system calls where ever possible to avoid path lookups. Signed-off-by: Mohammed Junaid <junaid@redhat.com> Change-Id: I482ea29ebe0859d0a5307ff25ecb5945d54bc7ca Reviewed-on: http://review.gluster.org/5251 Reviewed-by: Peter Portante <pportant@redhat.com> Tested-by: Peter Portante <pportant@redhat.com>
Diffstat (limited to 'gluster/swift/common/fs_utils.py')
-rw-r--r--gluster/swift/common/fs_utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gluster/swift/common/fs_utils.py b/gluster/swift/common/fs_utils.py
index de450a5..b3f58b7 100644
--- a/gluster/swift/common/fs_utils.py
+++ b/gluster/swift/common/fs_utils.py
@@ -74,6 +74,15 @@ def do_chown(path, uid, gid):
return True
+def do_fchown(fd, uid, gid):
+ try:
+ os.fchown(fd, uid, gid)
+ except OSError as err:
+ logging.exception("fchown failed on %d err: %s", fd, err.strerror)
+ raise
+ return True
+
+
def do_stat(path):
try:
#Check for fd.