path: root/xlators/features/locks
diff options
authorPranith Kumar K <>2012-06-15 15:13:31 +0530
committerAnand Avati <>2012-06-19 23:50:30 -0700
commit79aa6092a277975cb618d89da645080e51958543 (patch)
tree1c24f103ab1c48d3884aeafe59cfc4410c8287f7 /xlators/features/locks
parentd51d9b4154d6a70efcde30514620cc0442252436 (diff)
protocol/client: Re-open should not have O_CREAT|O_TRUNC|O_EXCL
RCA The bug is observed in 3.2.x because posix xlator changes the uid/gid of file as per frame->root-uid/gid if O_CREAT flag is set in open fop. Posix does not do this in 3.3.x so that bug does not appear anymore but this issue exposed the actual bug in client xlator re-open. Re-open of a file on re-connection should not perform re-open with the same flags at the time of open/create/opendir. Imagine a case where a file is opened with O_TRUNC|O_RDWR and some data is written to it, now if the brick goes down and comes back the file will be truncated. When I tested this case, the file is not truncated because locks xlator resets O_TRUNC unconditionally. Client xlator re-open bug and locks xlator bug cancel each other. Fix Reset O_CREAT|O_TRUNC|O_EXCL flags in re-open. Locks xlator should not reset O_TRUNC. Additional changes Removed wbflags as it is not assigned at all. Testcases Automated go program is at: :// Change-Id: I0080344fdda2e62e7c976c35a5bf5f1fa8838891 BUG: 807976 Signed-off-by: Pranith Kumar K <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Jeff Darcy <> Reviewed-by: Raghavendra Bhat <> Reviewed-by: Anand Avati <>
Diffstat (limited to 'xlators/features/locks')
1 files changed, 1 insertions, 2 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 2c0f583..90caadb0 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -614,10 +614,9 @@ int
pl_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, dict_t *xdata)
- /* why isn't O_TRUNC being handled ? */
STACK_WIND (frame, pl_open_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->open,
- loc, flags & ~O_TRUNC, fd, xdata);
+ loc, flags, fd, xdata);
return 0;