Whamcloud - gitweb
LU-8735 llite: Return -ERESTARTSYS in range_lock()
[fs/lustre-release.git] / lustre / utils / lustre_rsync.c
index c3eab0f..2be588c 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
  *      [pfid,tfid,name] tracked from (1) is used for this.
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <utime.h>
 #include <time.h>
 #include <sys/xattr.h>
+#include <linux/types.h>
 
+#include <libcfs/libcfs_debug.h>
 #include <libcfs/util/string.h>
 #include <libcfs/util/parser.h>
 #include <lustre/lustreapi.h>
-#include <lustre/lustre_idl.h>
 #include "lustre_rsync.h"
 
 #define REPLICATE_STATUS_VER 1
@@ -612,8 +610,13 @@ int lr_mkfile(struct lr_info *info)
         } 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) {
@@ -908,7 +911,7 @@ int lr_move(struct lr_info *info)
         int special_dest = 0;
        char srcpath[PATH_MAX + 1] = "";
 
-       LASSERT(info->is_extended);
+       assert(info->is_extended);
 
        rc_src = lr_get_path(info, info->spfid);
        if (rc_src < 0 && rc_src != -ENOENT)