diff options
author | Ravishankar N <ravishankar@redhat.com> | 2017-08-08 21:42:03 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-08-12 13:29:47 +0000 |
commit | 517316470e8e309e0e572264ee3c02b0748acab1 (patch) | |
tree | 188b20ed185fc4e8475ff8cd4fe3a0a8b81619d8 /xlators/features/trash/src/trash.c | |
parent | 40d65fb360afac01c593a4cf47851cf9ee50ad96 (diff) |
posix: add null gfid checks
(Backport of https://review.gluster.org/17975)
...in file/dir creation and lookup codepaths. The check is relaxed for
fops coming from trash xlator at the moment until trash has client side
logic to send the create fops with gfid-req.
Also fixed the missing trash pid assignment in creates sent by trash
xlator. Without this, truncated files won't be moved to .trashcan.
Change-Id: Ieddd7f0634850e7c7010e4fbb4ad1eead35888c8
BUG: 1479474
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://review.gluster.org/17996
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/features/trash/src/trash.c')
-rw-r--r-- | xlators/features/trash/src/trash.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index ab01832bb8b..4a41a14f427 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -1579,6 +1579,8 @@ trash_truncate_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; GF_VALIDATE_OR_GOTO ("trash", local, out); + TRASH_UNSET_PID (frame, local); + /* Checks whether path is present in trash directory or not */ if ((op_ret == -1) && (op_errno == ENOENT)) { @@ -1753,6 +1755,9 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strcat (real_path, local->origpath); /* Call create again once directory structure is created. */ + + TRASH_SET_PID (frame, local); + STACK_WIND (frame, trash_truncate_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, @@ -1957,6 +1962,8 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, flags = O_CREAT|O_EXCL|O_WRONLY; + TRASH_SET_PID (frame, local); + STACK_WIND (frame, trash_truncate_create_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, |