Skip to contentSkip to conversation

Enabling lazy counters damages filesystem

DISCUSSION Marcin Mirosław 3 participants 7 messages Apr 28, 2010 – Apr 29, 2010

lore
Share & tools
lore
#0 lore raw

Hello,
Please look at this:

# mkfs.xfs -f /dev/malowazne/test
meta-data=/dev/malowazne/test    isize=256    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# xfs_check /dev/malowazne/test
# xfs_check /dev/malowazne/test

It's still clean.

# xfs_admin -c 1 /dev/malowazne/test
Enabling lazy-counters
# xfs_check /dev/malowazne/test
sb_features2 (0xa) not same as sb_bad_features2 (0x8)

Not good, let's repair fs:

# xfs_repair /dev/malowazne/test
Phase 1 - find and verify superblock...
superblock has a features2 mismatch, correcting
writing modified primary superblock
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done

Now i'm trying to turn off lazy counters:

# xfs_admin -c 0 /dev/malowazne/test
Disabling lazy-counters
# xfs_check /dev/malowazne/test
sb_features2 (0x8) not same as sb_bad_features2 (0xa)
# xfs_repair /dev/malowazne/test
Phase 1 - find and verify superblock...
superblock has a features2 mismatch, correcting
writing modified primary superblock
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
# mount /dev/malowazne/test /mnt/test
# xfs_info /dev/malowazne/test
meta-data=/dev/mapper/malowazne-test isize=256    agcount=4,
agsize=524288 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

So as you can see lazy conters are still turn on. I'm using:

# mkfs.xfs -V
mkfs.xfs version 3.0.3
# uname -r
2.6.33-zen2

The same problem noticed with kernel-2.6.28-r9 with grsecurity, and with xfsprogs-3.0.0 .
Is this behaviour bug or i don't know about something that i should?:)

Regards!
Marcin

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 15 lines · Marcin Miros?aw

Hello,
Please look at this:

# mkfs.xfs -f /dev/malowazne/test
meta-data=/dev/malowazne/test    isize=256    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# xfs_check /dev/malowazne/test
# xfs_check /dev/malowazne/test
Quoted 6 lines

It's still clean.

# xfs_admin -c 1 /dev/malowazne/test
Enabling lazy-counters
# xfs_check /dev/malowazne/test
sb_features2 (0xa) not same as sb_bad_features2 (0x8)

ok, I guess that mechanism is not hitting both sb fields.

Should be a trivial fix, something like below.

-Eric

repair/phase1.c +2 -0
index 618796e..dbfbc9b 100644
@@ -117,11 +117,13 @@ phase1(xfs_mount_t *mp)
 		if (lazy_count && !xfs_sb_version_haslazysbcount(sb)) {
 			sb->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
 			sb->sb_features2 |= XFS_SB_VERSION2_LAZYSBCOUNTBIT;
+			sb->sb_bad_features2 |= XFS_SB_VERSION2_LAZYSBCOUNTBIT;
 			primary_sb_modified = 1;
 			printf(_("Enabling lazy-counters\n"));
 		} else
 		if (!lazy_count && xfs_sb_version_haslazysbcount(sb)) {
 			sb->sb_features2 &= ~XFS_SB_VERSION2_LAZYSBCOUNTBIT;
+			sb->sb_bad_features2 &= ~XFS_SB_VERSION2_LAZYSBCOUNTBIT;
 			printf(_("Disabling lazy-counters\n"));
 			primary_sb_modified = 1;
 		} else {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
In reply to Marcin Mirosław
Quoted 21 lines · Marcin Mirosław

Hello,
Please look at this:

# mkfs.xfs -f /dev/malowazne/test
meta-data=/dev/malowazne/test    isize=256    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# xfs_check /dev/malowazne/test
# xfs_check /dev/malowazne/test

It's still clean.

# xfs_admin -c 1 /dev/malowazne/test
Enabling lazy-counters
# xfs_check /dev/malowazne/test
sb_features2 (0xa) not same as sb_bad_features2 (0x8)

....

Quoted 4 lines

So as you can see lazy conters are still turn on.
I'm using:

# mkfs.xfs -V
mkfs.xfs version 3.0.3

This was fixed in 3.0.5, IIRC. Please upgrade.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw
Quoted 22 lines · Dave Chinner
Quoted 15 lines · Marcin Mirosław

Hello,
Please look at this:

# mkfs.xfs -f /dev/malowazne/test
meta-data=/dev/malowazne/test    isize=256    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# xfs_check /dev/malowazne/test
# xfs_check /dev/malowazne/test
Quoted 6 lines

It's still clean.

# xfs_admin -c 1 /dev/malowazne/test
Enabling lazy-counters
# xfs_check /dev/malowazne/test
sb_features2 (0xa) not same as sb_bad_features2 (0x8)
Quoted 8 lines

....

Quoted 4 lines

So as you can see lazy conters are still turn on.
I'm using:

# mkfs.xfs -V
mkfs.xfs version 3.0.3

This was fixed in 3.0.5, IIRC. Please upgrade.

Actually, 3.1.0 was the first release with the fix to xfs_db that prevents this problem.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

Dave Chinner wrote:

...

Quoted 6 lines

Actually, 3.1.0 was the first release with the fix to xfs_db that prevents this problem.

Cheers,

Dave.

not so sure:

# rpm -q xfsprogs
xfsprogs-3.1.1-7
# mkfs.xfs -dfile,name=fsfile,size=10g -llazy-count=0
meta-data=fsfile                 isize=256    agcount=4, agsize=655360 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=2621440, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# xfs_admin -c 1 fsfile 
Enabling lazy-counters
# xfs_check fsfile 
sb_features2 (0xa) not same as sb_bad_features2 (0x8)
# xfs_repair fsfile 
Phase 1 - find and verify superblock...
superblock has a features2 mismatch, correcting
writing modified primary superblock
...

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw
Quoted 4 lines · Eric Sandeen

Dave Chinner wrote:

...

Quoted 8 lines
Quoted 6 lines

Actually, 3.1.0 was the first release with the fix to xfs_db that prevents this problem.

Cheers,

Dave.

not so sure:

Yeah, you are right. I was thinking that xfs_db did the feature bit modifications, then repair just fixed up the accounting. but repair does both in this case. I should remember code that I wrote years ago, but for some reason it all seems to be a little bit hazy...

Let me go look at your repair patch again ;)

Cheers,

dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw

W dniu 29.04.2010 04:05, Dave Chinner pisze:

Quoted 6 lines

Yeah, you are right. I was thinking that xfs_db did the feature bit modifications, then repair just fixed up the accounting. but repair does both in this case. I should remember code that I wrote years ago, but for some reason it all seems to be a little bit hazy...

Let me go look at your repair patch again ;)

Hi,
Eric, Dave, thank you for quick replay and patch. Patch solves problem for me:)
Regards!
Marcin

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs