summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-entry-ops.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2018-03-16 10:15:52 +0530
committerAmar Tumballi <amarts@redhat.com>2018-04-10 02:39:55 +0000
commit25b8139c74ae3127905a86dd5f834c39746ad8d7 (patch)
tree1e400b8ccf17c181b91590e34c22a86043a058dc /xlators/storage/posix/src/posix-entry-ops.c
parent13c8bf60155b5ab09d60d4a04f2b0d38014e5fca (diff)
posix: check file state before continuing with fops
In context of Cloudsync: In scenarios where a data modification fop e.g. a write landed in POSIX thinking that the file is local, while the file was actually remote, can be dangerous. Ofcourse we don’t want to take inodelk for every read/write operation to check the archival status or coordinate with an upload or a download of a file. To avoid inodelk, we will check the status of the file in POSIX it self, before we resume the fop. This helps us avoiding any races mentioned above. Now e.g. if a write reached POSIX for a file which was actually remote, it can check the status of the file and will get to know that the file is remote. It can error out with this status “remote” and cloudsync xlator will retry the same operation, once it finished downloading the file. This patch includes the setxattr changes to do the post processing of upload i.e. truncate and setting the remote xattr "trusted.glusterfs.cs.remote" to indicate the file is REMOTE Each file will have no xattr if the file is LOCAL, one remote xattr if the file is REMOTE and a combination of REMOTE and DOWNLOADING xattr if the file is getting downloaded. There is healing logic of these xattrs to recover from crash inconsitencies. Fixes: #387 Change-Id: Ie93c2d41aa8d6a798a39bdbef9d1669f057e5fdb Signed-off-by: Susant Palai <spalai@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-entry-ops.c')
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index 69e125a45ab..0abe380ee43 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -252,6 +252,9 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
xattr = posix_xattr_fill (this, real_path, loc, NULL, -1, xdata,
&buf);
+ posix_cs_maintenance (this, NULL, loc, NULL, &buf, real_path,
+ xdata, &xattr, _gf_true);
+
if (dict_get (xdata, GF_CLEAN_WRITE_PROTECTION)) {
ret = sys_lremovexattr (real_path,
GF_PROTECT_FROM_EXTERNAL_WRITES);