summaryrefslogtreecommitdiffstats
path: root/xlators/features/trash/src
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2016-02-17 15:50:05 +0530
committerVijay Bellur <vbellur@redhat.com>2016-03-05 16:18:15 -0800
commit82674a299a3fa9b969c494d2d0a3e72600323af8 (patch)
tree0c2946e418f3f1676ce26093666f9ddcbe75184e /xlators/features/trash/src
parenta502ed404beb29e9c0a212489e19f636a1cbc442 (diff)
features/trash: Retain file permissions during truncate
Consider the situation where directory path for a truncated file does not exists under trash directory. In this scenario after creating the required path we failed to create the orginal file with proper permissions. Eventhough we try to fetch permissions from local->origpath, it was never filled with required value in truncate and ftruncate call paths. This change will copy original location to local->origpath inside both fop handling functions. >Change-Id: If5930b6d368d08e58f04db999f3f9edb9250bcb9 >BUG: 1309342 >Signed-off-by: Anoop C S <anoopcs@redhat.com> >Reviewed-on: http://review.gluster.org/13461 >Smoke: Gluster Build System <jenkins@build.gluster.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> (cherry picked from commit b1cb581424305592fac5394a578b307117b22fe7) Change-Id: I5d964b4d802551bb04a7011f88edb59a1231238e BUG: 1313233 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: http://review.gluster.org/13555 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/trash/src')
-rw-r--r--xlators/features/trash/src/trash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index c2d36bd37d7..8549c644bf3 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -1073,7 +1073,6 @@ trash_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflags,
loc_copy (&local->loc, loc);
/* rename new location of file as starting from trash directory */
- strcpy (local->origpath, pathbuf);
copy_trash_path (priv->newtrash_dir, (frame->root->pid < 0),
local->newpath);
strcat (local->newpath, pathbuf);
@@ -1725,6 +1724,8 @@ trash_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
goto out;
}
+ strcpy (local->origpath, pathbuf);
+
loc_copy (&local->loc, loc);
local->loc.path = pathbuf;
local->fop_offset = offset;
@@ -1819,6 +1820,8 @@ trash_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
goto out;
}
+ strcpy (local->origpath, pathbuf);
+
/* To convert fd to location */
frame->local=local;