From c7ce3beec168cfc530da9e8d11fc1a0e8c80bcce Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Date: Tue, 25 Jun 2013 07:50:28 +0530 Subject: 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 Change-Id: I482ea29ebe0859d0a5307ff25ecb5945d54bc7ca Reviewed-on: http://review.gluster.org/5251 Reviewed-by: Peter Portante Tested-by: Peter Portante --- gluster/swift/common/fs_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gluster/swift/common/fs_utils.py') 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. -- cgit