aalvarez pushed to dpm-dsi (el5). "Patch for the FTS2 issue"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Apr 7 09:58:39 UTC 2015


>From 413c54d92c867fc2bd03114e4945d2fbb3c44785 Mon Sep 17 00:00:00 2001
From: simonm <michal.simon at cern.ch>
Date: Fri, 23 May 2014 19:05:29 +0200
Subject: Patch for the FTS2 issue


diff --git a/dpm-dsi-fts2_issue.patch b/dpm-dsi-fts2_issue.patch
new file mode 100644
index 0000000..18ae0bc
--- /dev/null
+++ b/dpm-dsi-fts2_issue.patch
@@ -0,0 +1,75 @@
+Index: src/dmlite_internal.c
+===================================================================
+--- src/dmlite_internal.c	(.../tags/dpm-dsi_1_9_3d)	(revision 10465)
++++ src/dmlite_internal.c	(.../trunk)	(revision 10465)
+@@ -399,7 +399,7 @@
+ 		dmlite_handle_obj->is_replica = GLOBUS_TRUE;
+ 		dmlite_query = dmlite_location_obj->chunks[0].url.query;
+ 	} else if (local || dmlite_errno(dmlite_context_obj) == ENOENT) {
+-		if (dmlite_accessr(dmlite_context_obj, rfn, mode)) {
++		if (!(flags & O_INSECURE) && dmlite_accessr(dmlite_context_obj, rfn, mode)) {
+ 			dmlite_gfs_log(dmlite_handle_obj, GLOBUS_GFS_LOG_ERR, "access to RFN denied :: %s :: %s",
+ 					rfn, dmlite_error(dmlite_context_obj));
+ 			goto errout;
+Index: src/dmlite_gridftp.c
+===================================================================
+--- src/dmlite_gridftp.c	(.../tags/dpm-dsi_1_9_3d)	(revision 10465)
++++ src/dmlite_gridftp.c	(.../trunk)	(revision 10465)
+@@ -178,13 +178,14 @@
+ 	struct dmlite_xstat	dmlite_xstat_obj;
+ 	struct dmlite_dir *	dir_fd;
+ 	struct dmlite_xstat *	dir_entry_xstat;
++	struct stat		tmpstat;
+ 	int			nfiles, ctx_err;
+ 	const char *		localpath = dmlite_gfs_fixpath(stat_info->pathname, GLOBUS_FALSE);
+ 	const char *		rfn = dmlite_gfs_fixpath(stat_info->pathname, GLOBUS_TRUE);
+ 
+ 	GlobusGFSName(globus_l_gfs_dmlite_stat);
+ 
+-	dmlite_gfs_log(dmlite_handle_obj, GLOBUS_GFS_LOG_INFO, "stat :: %s", localpath);
++	dmlite_gfs_log(dmlite_handle_obj, GLOBUS_GFS_LOG_INFO, "stat :: %s", stat_info->pathname);
+ 
+ 	/* Get a dmlite_context object */
+ 	dmlite_context_obj = dmlite_get_context(dmlite_handle_obj, &ctx_err);
+@@ -211,7 +212,31 @@
+ finstat:
+ 	/* File like info on the entry is easy to handle */
+ 	if (!S_ISDIR(dmlite_xstat_obj.stat.st_mode) || stat_info->file_only) {
+-		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_INFO, "stat :: %s :: entry info only", localpath);
++		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_INFO, "stat :: single entry");
++		/* Workaround for partially written replicas */
++		if (dmlite_xstat_obj.stat.st_size != 0)
++			goto giveup;
++		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_WARN, "stat :: zero size replica");
++		if (dmlite_handle_obj->fd) {
++			/* Ignore this error */
++			posix_error2gfs_result(_gfs_name, dmlite_handle_obj, EINVAL, "session already has a file open");
++			goto giveup;
++		}
++		if (!dmlite_gfs_open(dmlite_context_obj, dmlite_handle_obj, rfn, O_RDONLY | O_INSECURE)) {
++			/* Ignore this error */
++			dmlite_error2gfs_result(_gfs_name, dmlite_handle_obj, dmlite_context_obj);
++			goto giveup;
++		}
++		if (dmlite_fstat(dmlite_handle_obj->fd, &tmpstat)) {
++			/* Ignore this error */
++			dmlite_error2gfs_result(_gfs_name, dmlite_handle_obj, dmlite_context_obj);
++			dmlite_gfs_close(NULL, dmlite_handle_obj, 0);
++			goto giveup;
++		}
++		dmlite_xstat_obj.stat.st_size = tmpstat.st_size;
++		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_WARN, "stat :: actual file size is %lld", tmpstat.st_size);
++		dmlite_gfs_close(NULL, dmlite_handle_obj, 0);
++giveup:
+ 		/* Allocate the stat array */
+ 		gfs_stat_array = (globus_gfs_stat_t *)globus_malloc(sizeof(globus_gfs_stat_t));
+ 		if (!gfs_stat_array) {
+@@ -222,7 +247,7 @@
+ 		stat_count = 1;
+ 	} else { /* Going through directory is a bit more work */
+ 		nfiles  = dmlite_xstat_obj.stat.st_nlink;
+-		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_INFO, "stat :: %s :: full dir info with %d files", localpath, nfiles);
++		dmlite_gfs_log(NULL, GLOBUS_GFS_LOG_INFO, "stat :: full directory with %d files", nfiles);
+ 
+ 		/* Allocate the stat array */
+ 		gfs_stat_array = (globus_gfs_stat_t *)globus_malloc(sizeof(globus_gfs_stat_t) * nfiles);
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/dpm-dsi.git/commit/?h=el5&id=413c54d92c867fc2bd03114e4945d2fbb3c44785


More information about the scm-commits mailing list