forked from pool/e2fsprogs
b8b5069980
Rev SUSE:SLE-15:Update/6 Md5 d8f0e1e9351003e8fa23e76a764813bf 2020-04-08 11:34:04 hlohr None
97 lines
3.7 KiB
Diff
97 lines
3.7 KiB
Diff
From 125850eb92f042c76b6f001bf63833ffc15e7916 Mon Sep 17 00:00:00 2001
|
|
From: Jan Kara <jack@suse.cz>
|
|
Date: Thu, 13 Feb 2020 11:15:56 +0100
|
|
Subject: [PATCH] e2fsck: clarify overflow link count error message
|
|
References: bsc#1160979
|
|
|
|
When directory link count is set to overflow value (1) but during pass 4
|
|
we find out the exact link count would fit, we either silently fix this
|
|
(which is not great because e2fsck then reports the fs was modified but
|
|
output doesn't indicate why in any way), or we report that link count is
|
|
wrong and ask whether we should fix it (in case -n option was
|
|
specified). The second case is even more misleading because it suggests
|
|
non-trivial fs corruption which then gets silently fixed on the next
|
|
run. Similarly to how we fix up other non-problems, just create a new
|
|
error message for the case directory link count is not overflown anymore
|
|
and always report it to clarify what is going on.
|
|
|
|
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
(cherry picked from commit 4ebce13292f54c96f43dcb1bd1d5b8df5dc8749d)
|
|
Acked-by: Jan Kara <jack@suse.cz>
|
|
---
|
|
e2fsck/pass4.c | 20 ++++++++++++++++----
|
|
e2fsck/problem.c | 5 +++++
|
|
e2fsck/problem.h | 3 +++
|
|
3 files changed, 24 insertions(+), 4 deletions(-)
|
|
|
|
Index: e2fsprogs-1.43.8/e2fsck/pass4.c
|
|
===================================================================
|
|
--- e2fsprogs-1.43.8.orig/e2fsck/pass4.c
|
|
+++ e2fsprogs-1.43.8/e2fsck/pass4.c
|
|
@@ -169,6 +169,8 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|
if (isdir && (link_counted > EXT2_LINK_MAX))
|
|
link_counted = 1;
|
|
if (link_counted != link_count) {
|
|
+ int fix_nlink = 0;
|
|
+
|
|
e2fsck_read_inode_full(ctx, i, EXT2_INODE(inode),
|
|
inode_size, "pass4");
|
|
pctx.ino = i;
|
|
@@ -182,10 +184,20 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|
pctx.num = link_counted;
|
|
/* i_link_count was previously exceeded, but no longer
|
|
* is, fix this but don't consider it an error */
|
|
- if ((isdir && link_counted > 1 &&
|
|
- (inode->i_flags & EXT2_INDEX_FL) &&
|
|
- link_count == 1 && !(ctx->options & E2F_OPT_NO)) ||
|
|
- fix_problem(ctx, PR_4_BAD_REF_COUNT, &pctx)) {
|
|
+ if (isdir && link_counted > 1 &&
|
|
+ (inode->i_flags & EXT2_INDEX_FL) &&
|
|
+ link_count == 1) {
|
|
+ if ((ctx->options & E2F_OPT_READONLY) == 0) {
|
|
+ fix_nlink =
|
|
+ fix_problem(ctx,
|
|
+ PR_4_DIR_OVERFLOW_REF_COUNT,
|
|
+ &pctx);
|
|
+ }
|
|
+ } else {
|
|
+ fix_nlink = fix_problem(ctx, PR_4_BAD_REF_COUNT,
|
|
+ &pctx);
|
|
+ }
|
|
+ if (fix_nlink) {
|
|
inode->i_links_count = link_counted;
|
|
e2fsck_write_inode_full(ctx, i,
|
|
EXT2_INODE(inode),
|
|
Index: e2fsprogs-1.43.8/e2fsck/problem.c
|
|
===================================================================
|
|
--- e2fsprogs-1.43.8.orig/e2fsck/problem.c
|
|
+++ e2fsprogs-1.43.8/e2fsck/problem.c
|
|
@@ -1857,6 +1857,11 @@ static struct e2fsck_problem problem_tab
|
|
"They @s the same!\n"),
|
|
PROMPT_NONE, 0 },
|
|
|
|
+ /* Directory inode ref count set to overflow but could be exact value */
|
|
+ { PR_4_DIR_OVERFLOW_REF_COUNT,
|
|
+ N_("@d @i %i ref count set to overflow but could be exact value %N. "),
|
|
+ PROMPT_FIX, PR_PREEN_OK, 0, 0, 0 },
|
|
+
|
|
/* Pass 5 errors */
|
|
|
|
/* Pass 5: Checking group summary information */
|
|
Index: e2fsprogs-1.43.8/e2fsck/problem.h
|
|
===================================================================
|
|
--- e2fsprogs-1.43.8.orig/e2fsck/problem.h
|
|
+++ e2fsprogs-1.43.8/e2fsck/problem.h
|
|
@@ -1123,6 +1123,9 @@ struct problem_context {
|
|
/* Inconsistent inode count information cached */
|
|
#define PR_4_INCONSISTENT_COUNT 0x040004
|
|
|
|
+/* Directory ref count set to overflow but it doesn't have to be */
|
|
+#define PR_4_DIR_OVERFLOW_REF_COUNT 0x040007
|
|
+
|
|
/*
|
|
* Pass 5 errors
|
|
*/
|