[PATCH v2 12/18] fsck.overlay: remove duplicate redirect xattr in yes mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For the duplicate redirect directories which point to the same origin,
we cannot confirm which one is invalid now, so cannot remove it in 'auto'
mode for safty reason. But in 'yes' mode, we remove the duplicate one
directly for consistency.

Signed-off-by: zhangyi (F) <yi.zhang@xxxxxxxxxx>
---
 check.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/check.c b/check.c
index 99cd95a..1e40cac 100644
--- a/check.c
+++ b/check.c
@@ -378,7 +378,8 @@ static void ovl_redirect_free(void)
  * 1) Check the origin directory exist or not. If not, remove xattr.
  * 2) Count how many directories the origin directory was redirected by.
  *    If more than one in the same layer, there must be some inconsistency
- *    but not sure, just warn.
+ *    but not sure which one is invalid, just warn in 'auto' mode and remove
+ *    the duplicate one in 'yes' mode.
  * 3) Check and fix the missing whiteout or opaque in redierct parent dir.
  */
 static int ovl_check_redirect(struct scan_ctx *sctx)
@@ -420,7 +421,11 @@ static int ovl_check_redirect(struct scan_ctx *sctx)
 				   chk.path, pathname, tmp);
 
 			sctx->redirects[SC_INVALID]++;
-			set_st_inconsistency(&status);
+
+			/* Don't remove in auto mode */
+			if (ovl_ask_invalid("Duplicate redirect xattr",
+					     pathname, 0))
+				goto remove_d;
 		}
 
 		ovl_redirect_entry_add(pathname, sctx->dirtype,
@@ -461,7 +466,7 @@ remove:
 	/* Remove redirect xattr or ask user */
 	if (!ovl_ask_invalid("Invalid redirect xattr", pathname, 1))
 		goto out;
-
+remove_d:
 	ret = ovl_remove_redirect(pathname);
 	if (!ret)
 		sctx->redirects[SC_INVALID_DEL]++;
-- 
2.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux