Whamcloud - gitweb
LU-6229 utils: fix lustre_rsync bug of cascade move 14/14914/3
authorLi Xi <lixi@ddn.com>
Fri, 22 May 2015 04:07:00 +0000 (12:07 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Dec 2015 17:51:49 +0000 (17:51 +0000)
When replaying the changelog, destination files have to be
put into a special directory, if their parent directory is
possessing a different path other than the ultimate path
because of renaming. With the replaying process going on,
when the parent directory is being moved to the ultimate path,
the child files should be moved under the parent directory
which is called cascade move.

As long as a directory has child files under sepcial direcoty,
cascade move should happen, no matter the direcotry is being
renamed from sepcial direcoty or not. This patch fixes the problem
that cascade move is missing when the direcotry is being renamed
from ordinary path.

Signed-off-by: Li Xi <lixi@ddn.com>
Change-Id: I2d21604b81fe0cf08df1af2bfccc90a32986bf05
Reviewed-on: http://review.whamcloud.com/14914
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lustre_rsync.c

index 1830ac1..112a21c 100644 (file)
@@ -959,12 +959,12 @@ int lr_move(struct lr_info *info)
                        lr_debug(DINFO, "rename returns %d\n", rc1);
                 }
 
-               if (special_src) {
+               if (special_src)
                        rc1 = lr_remove_pc(info->spfid, info->sfid);
-                       if (!special_dest)
-                               lr_cascade_move(info->sfid, info->dest, info);
-                }
-               if (special_dest)
+
+               if (!special_dest)
+                       lr_cascade_move(info->sfid, info->dest, info);
+               else
                        rc1 = lr_add_pc(info->pfid, info->sfid, info->name);
 
                 lr_debug(DINFO, "move: %s [to] %s rc1=%d, errno=%d\n",