Whamcloud - gitweb
LU-4781 utils: handle EEXIST in lustre_rsync 49/20649/2
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 6 Jun 2016 20:06:59 +0000 (15:06 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:56:20 +0000 (03:56 +0000)
In lustre_rsync if the file to be created in the target already exist
then handle this rather than returning an error.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I8c04c80cf8618b3681be12d098be0f07a305df30
Reviewed-on: http://review.whamcloud.com/20649
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lustre_rsync.c

index c3eab0f..08de581 100644 (file)
@@ -612,8 +612,13 @@ int lr_mkfile(struct lr_info *info)
         } else {
                 rc = mknod(info->dest, S_IFREG | 0777, 0);
         }
         } else {
                 rc = mknod(info->dest, S_IFREG | 0777, 0);
         }
-        if (rc)
-                return -errno;
+
+       if (rc < 0) {
+               if (errno == EEXIST)
+                       rc = 0;
+               else
+                       return -errno;
+       }
 
         /* Sync data and attributes */
         if (info->type == CL_CREATE || info->type == CL_MKDIR) {
 
         /* Sync data and attributes */
         if (info->type == CL_CREATE || info->type == CL_MKDIR) {