linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalpak Shah <kalpak@clusterfs.com>
To: TheodoreTso <tytso@mit.edu>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: [PATCH] e2fsprogs: Offsets of EAs in inode need not be sorted
Date: Thu, 19 Apr 2007 17:35:36 +0530	[thread overview]
Message-ID: <1176984336.3812.10.camel@garfield> (raw)

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

Hi,

This patch removes a code snippet from check_ea_in_inode() in pass1 which checks if the EA values in the inode are sorted or not. The comments in fs/ext*/xattr.c state that the EA values in the external EA block are sorted but those in the inode need not be sorted. I have also attached a test image which has unsorted EAs in the inodes. The current e2fsck wrongly clears the EAs in the inode.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>

Index: e2fsprogs-1.40/e2fsck/pass1.c
===================================================================
--- e2fsprogs-1.40.orig/e2fsck/pass1.c
+++ e2fsprogs-1.40/e2fsck/pass1.c
@@ -246,7 +246,7 @@ static void check_ea_in_inode(e2fsck_t c
 	struct ext2_inode_large *inode;
 	struct ext2_ext_attr_entry *entry;
 	char *start, *end;
-	unsigned int storage_size, remain, offs;
+	unsigned int storage_size, remain;
 	int problem = 0;
 
 	inode = (struct ext2_inode_large *) pctx->inode;
@@ -261,7 +261,6 @@ static void check_ea_in_inode(e2fsck_t c
 
 	/* take finish entry 0UL into account */
 	remain = storage_size - sizeof(__u32); 
-	offs = end - start;
 
 	while (!EXT2_EXT_IS_LAST_ENTRY(entry)) {
 
@@ -285,15 +284,6 @@ static void check_ea_in_inode(e2fsck_t c
 			goto fix;
 		}
 
-		/* check value placement */
-		if (entry->e_value_offs + 
-		    EXT2_XATTR_SIZE(entry->e_value_size) != offs) {
-			printf("(entry->e_value_offs + entry->e_value_size: %d, offs: %d)\n", entry->e_value_offs + entry->e_value_size, offs);
-			pctx->num = entry->e_value_offs;
-			problem = PR_1_ATTR_VALUE_OFFSET;
-			goto fix;
-		}
-	
 		/* e_value_block must be 0 in inode's ea */
 		if (entry->e_value_block != 0) {
 			pctx->num = entry->e_value_block;
@@ -309,7 +299,6 @@ static void check_ea_in_inode(e2fsck_t c
 		}
 
 		remain -= entry->e_value_size;
-		offs -= EXT2_XATTR_SIZE(entry->e_value_size);
 
 		entry = EXT2_EXT_ATTR_NEXT(entry);
 	}

Thanks,
Kalpak Shah.
<kalpak@clusterfs.com>

[-- Attachment #2: foo.img.gz --]
[-- Type: application/x-gzip, Size: 15676 bytes --]

             reply	other threads:[~2007-04-19 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 12:05 Kalpak Shah [this message]
2007-04-20 12:38 ` [PATCH] e2fsprogs: Offsets of EAs in inode need not be sorted Theodore Tso
2007-04-20 13:05   ` Kalpak Shah
2007-04-20 14:10     ` Theodore Tso
2007-04-20 19:17       ` Kalpak Shah
2007-05-08  5:07 ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1176984336.3812.10.camel@garfield \
    --to=kalpak@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).