Skip to contentSkip to conversation

e2fsck: don't check/clone duplicate xattr blocks in fs without xattr feature

PATCH Applied Eric Sandeen 2 participants 6 messages Feb 9, 2011 – Jun 1, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsck: don't check/clone duplicate xattr blocks in fs without xattr feature

I had an extremely corrupted customer filesystem which, after thousands of lines of e2fsck output, found one more problem on an immediately subsequent e2fsck. In short, a file had had its i_file_acl block cloned due to being a duplicate. That ultimately got cleared because the fs did not have the xattr feature, and the inode was subsequently removed due to invalid mode.

The 2nd e2fsck pass found the cloned xattr block as in use, but not owned by any file, and had to fix up the block bitmaps.

Simply skipping the processing of duplicate xattr blocks on a non-xattr filesystem seems reasonable, since they will be cleared later in any case.

(also fix existing brace misalignment)

---

e2fsck/pass1b.c +4 -2
index 155fcba..2ddaeb4 100644
@@ -310,12 +310,14 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
 			pctx.errcode = ext2fs_block_iterate3(fs, ino,
 					     BLOCK_FLAG_READ_ONLY, block_buf,
 					     process_pass1b_block, &pb);
-		if (ext2fs_file_acl_block(&inode)) {
+		/* If the feature is not set, attrs will be cleared later anyway */
+		if ((fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) &&
+		    ext2fs_file_acl_block(&inode)) {
 			blk64_t blk = ext2fs_file_acl_block(&inode);
 			process_pass1b_block(fs, &blk,
 					     BLOCK_COUNT_EXTATTR, 0, 0, &pb);
 			ext2fs_file_acl_block_set(&inode, blk);
-			}
+		}
 		if (pb.dup_blocks) {
 			end_problem_latch(ctx, PR_LATCH_DBLOCK);
 			if (ino >= EXT2_FIRST_INODE(fs->super) ||
#1 lore raw
Quoted 10 lines · Eric Sandeen

I had an extremely corrupted customer filesystem which, after thousands of lines of e2fsck output, found one more problem on an immediately subsequent e2fsck. In short, a file had had its i_file_acl block cloned due to being a duplicate. That ultimately got cleared because the fs did not have the xattr feature, and the inode was subsequently removed due to invalid mode.

The 2nd e2fsck pass found the cloned xattr block as in use, but not owned by any file, and had to fix up the block bitmaps.

Quoted 7 lines

Simply skipping the processing of duplicate xattr blocks on a non-xattr filesystem seems reasonable, since they will be cleared later in any case.

(also fix existing brace misalignment)

Ted, ping on this one? Would like to get it upstream before pushing it to RHEL, because as we all know now, that's how we roll at Red Hat. :)

Thanks,
-Eric

Quoted 27 lines

---

e2fsck/pass1b.c +4 -3
index 155fcba..2ddaeb4 100644
@@ -310,12 +310,14 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
 			pctx.errcode = ext2fs_block_iterate3(fs, ino,
 					     BLOCK_FLAG_READ_ONLY, block_buf,
 					     process_pass1b_block, &pb);
-		if (ext2fs_file_acl_block(&inode)) {
+		/* If the feature is not set, attrs will be cleared later anyway */
+		if ((fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) &&
+		    ext2fs_file_acl_block(&inode)) {
 			blk64_t blk = ext2fs_file_acl_block(&inode);
 			process_pass1b_block(fs, &blk,
 					     BLOCK_COUNT_EXTATTR, 0, 0, &pb);
 			ext2fs_file_acl_block_set(&inode, blk);
-			}
+		}
 		if (pb.dup_blocks) {
 			end_problem_latch(ctx, PR_LATCH_DBLOCK);
 			if (ino >= EXT2_FIRST_INODE(fs->super) ||
--

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 15 lines · Eric Sandeen
Quoted 14 lines · Eric Sandeen

I had an extremely corrupted customer filesystem which, after thousands of lines of e2fsck output, found one more problem on an immediately subsequent e2fsck. In short, a file had had its i_file_acl block cloned due to being a duplicate. That ultimately got cleared because the fs did not have the xattr feature, and the inode was subsequently removed due to invalid mode.

The 2nd e2fsck pass found the cloned xattr block as in use, but not owned by any file, and had to fix up the block bitmaps.

Simply skipping the processing of duplicate xattr blocks on a non-xattr filesystem seems reasonable, since they will be cleared later in any case.

Quoted 7 lines
Quoted 3 lines

(also fix existing brace misalignment)

Ted, ping on this one? Would like to get it upstream before pushing it to RHEL, because as we all know now, that's how we roll at Red Hat. :)

Ping again, for review and/or merge of this one, it's approaching 4 months old now...

Thanks,
-Eric

#3 lore raw
Quoted 2 lines · Eric Sandeen

Ping again, for review and/or merge of this one, it's approaching 4 months old now...

Actually I'll rebase & resend now.

#4 lore raw
Quoted 6 lines · Eric Sandeen
Quoted 2 lines · Eric Sandeen

Ping again, for review and/or merge of this one, it's approaching 4 months old now...

Actually I'll rebase & resend now.

Argh, I take it back, too many trees, sorry. Original patch is still fine.

-Eric

Applied
#5 lore raw
In reply to Eric Sandeen
Quoted 10 lines · Eric Sandeen

I had an extremely corrupted customer filesystem which, after thousands of lines of e2fsck output, found one more problem on an immediately subsequent e2fsck. In short, a file had had its i_file_acl block cloned due to being a duplicate. That ultimately got cleared because the fs did not have the xattr feature, and the inode was subsequently removed due to invalid mode.

The 2nd e2fsck pass found the cloned xattr block as in use, but not owned by any file, and had to fix up the block bitmaps.

Quoted 7 lines

Simply skipping the processing of duplicate xattr blocks on a non-xattr filesystem seems reasonable, since they will be cleared later in any case.

(also fix existing brace misalignment)

Applied, sorry for the delay.

- Ted