All of lore.kernel.org
 help / color / mirror / Atom feed
* Assert in xfs_repair (Phase 7) and other xfs_restore problems
@ 2012-07-20 20:59 Jon Peatfield
  2012-07-23 17:47 ` Jon Peatfield
  2012-07-23 23:54 ` Dave Chinner
  0 siblings, 2 replies; 6+ messages in thread
From: Jon Peatfield @ 2012-07-20 20:59 UTC (permalink / raw)
  To: xfs; +Cc: Jon Peatfield

I have been trying and failing to repair an xfs filesystem.  Originally I 
was using the Scientific-Linux (like RHEL) provided xfs_repair (2.9.4) but 
when that failed I built the latest tarball (3.1.8)...

The fs is about 3TB (of which about 2.7TB was used) and is stored in an 
LVM volume on an external RAID-6 device.  The RAID unit seems to still be 
working fine and all the other LVs are still working fine.  The filesystem 
contained a number of trees of mostly hardlinked files (they were 
snapshots generated using rsync with --link-dest so many of the files will 
be hardlinked in a number of different trees depending on when they 
changed).

The original problem appeared after a power problem (UPS powering the 
server didn't last as long as a power cut) and the server just lost power. 
Perhaps it was in the middle of trying to sync data to the disk when it 
lost power...  Sadly I have no logs...

After the power outage the fs could still be mounted but attempts to write 
to some areas cased a kernel error and it would mark the fs as read-only.

So I tried xfs_repair and after reporting various problems it was fixing 
it got part way through Phase 6 and said it couldn't allocate enough 
memory:

# xfs_repair -v /dev/mapper/FornixRaid02-damtp--home
Phase 1 - find and verify superblock...
         - block cache size set to 1076208 entries
Phase 2 - using internal log
         - zero log...
zero_log: head block 44160 tail block 44160
         - 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...
  ...
Phase 6 - check inode connectivity...
         - resetting contents of realtime bitmap and summary inodes
         - traversing filesystem ...
         - agno = 0
bad hash table for directory inode 11062547 (no data entry): rebuilding
rebuilding directory inode 11062547
bad hash table for directory inode 11325503 (no data entry): rebuilding
rebuilding directory inode 11325503
...

         - agno = 6

corrupt inode 3232556081 (bad size 1199484739711432270 for local inode). 
This is a bug.
Please capture the filesystem metadata with xfs_metadump and
report it to xfs@oss.sgi.com.
cache_node_purge: refcount was 1, not zero (node=0x2bd3f34e10)

fatal error -- couldn't map inode 3232556081, err = 117

I cleared inode 3232556081, and tried again and this time it ended:

...
Phase 6 - check inode connectivity...
         - resetting contents of realtime bitmap and summary inodes
         - traversing filesystem ...
         - agno = 0
...
rebuilding directory inode 2160683526
entry "MainMenu.nib" in shortform directory inode 2163312939 points to 
free inode 3236719664junking entry
         - agno = 5
bad hash table for directory inode 2699911474 (no data entry): rebuilding
rebuilding directory inode 2699911474
         - agno = 6

fatal error -- malloc failed in longform_dir2_entry_check (3913471144 
bytes)

Now the original machine only has 12G ram so I figured it might not be 
enough for repairing this filesystem.

After some messing I moved the raid box over to a newer/faster machine 
with more memory (64G ram), tried again and got similar results):

# xfs_repair -vv /dev/mapper/FornixRaid02-damtp--home
Phase 1 - find and verify superblock...
         - icount = 59993728, imem = 234350, dblock = 789028352, dmem = 385267
         - block cache size set to 6109288 entries
Phase 2 - using internal log
         - zero log...
zero_log: head block 128 tail block 128
         - scan filesystem freespace and inode maps...
         - found root inode chunk
...

Phase 6 - check inode connectivity...
         - resetting contents of realtime bitmap and summary inodes
         - traversing filesystem ...
         - agno = 0
bad hash table for directory inode 12795415 (no data entry): rebuilding
rebuilding directory inode 12795415
         - agno = 1
         - agno = 2
bad hash table for directory inode 1084921399 (no data entry): rebuilding
rebuilding directory inode 1084921399
         - agno = 3
         - agno = 4
         - agno = 5
entry "config" in shortform directory inode 2697554725 points to free 
inode 3234425125junking entry
         - agno = 6

fatal error -- malloc failed in longform_dir2_entry_check (1090519072 
bytes)

At this point I did some searching of the mailing lists etc and found 
various references to using -P to avoid some problems (which I tried and 
it didn't make any difference) and -m to limit the memory which 2.9.4 
doesn't have so I build 3.1.8 from source and tried that...

# ./sbin/xfs_repair -vv -m 1024 /dev/FornixRaid02/damtp-home
Phase 1 - find and verify superblock...
         - max_mem = 1048576, icount = 59993664, imem = 234350, dblock = 789028352, dmem = 385267
         - block cache size set to 47368 entries
Phase 2 - using internal log
         - zero log...
zero_log: head block 128 tail block 128
         - scan filesystem freespace and inode maps...
...

(I lost the end of that because my session died when I foolishly tried to 
mount the filesystem and caused a panic and the machine to lock solid - 
but it also failed with a malloc error but at least told me the directory 
inode it was examining at the time).

Anyway having cleared that inode and a couple of others which similarly 
seemed to cause xfs_repair to fail I ran xfs_repair again and this time it 
output a huge volume of stuff about things it had never mentioned before:

Phase 1 - find and verify superblock...
         - max_mem = 49493955, icount = 44978048, imem = 175695, dblock = 789028352, dmem = 385267
         - block cache size set to 6110368 entries
Phase 2 - using internal log
         - zero log...
zero_log: head block 128 tail block 128
         - scan filesystem freespace and inode maps...
bad magic # 0x58443242 in btbno block 2/131687
expected level 0 got 736 in btbno block 2/131687
bad btree nrecs (3112, min=255, max=510) in btbno block 2/131687
invalid start block 0 in record 0 of bno btree block 2/131687
invalid length 704643088 in record 1 of bno btree block 2/131687
invalid start block 0 in record 2 of bno btree block 2/131687
invalid start block 36580992 in record 3 of bno btree block 2/131687
invalid start block 0 in record 4 of bno btree block 2/131687
invalid start block 140734317 in record 5 of bno btree block 2/131687
invalid start block 1670976796 in record 6 of bno btree block 2/131687
...
out-of-order bno btree record 261 (96779 1) block 3/408
out-of-order bno btree record 262 (96789 1) block 3/408
out-of-order bno btree record 263 (97176 1) block 3/408
out-of-order bno btree record 264 (97191 1) block 3/408
out-of-order bno btree record 265 (97206 1) block 3/408
out-of-order bno btree record 266 (97215 1) block 3/408
...
(lots and lots of both types of those messages)

Phase 3 - for each AG...
         - scan and clear agi unlinked lists...
         - process known inodes and perform inode discovery...
         - agno = 0
entry "/." at block 0 offset 32 in directory inode 268 references invalid 
inode 18374686479671623679
         clearing inode number in entry at offset 32...
entry at block 0 offset 32 in directory inode 268 has illegal name "/.": 
entry "/p377." at block 0 offset 48 in directory inode 268 references 
invalid inode 18374686479671623679
         clearing inode number in entry at offset 48...
entry at block 0 offset 48 in directory inode 268 has illegal name 
"/p377.": entry "/gii-wsp" at block 0 offset 184 in directory inode 268 
references invalid inode 18374686479671623679
         clearing inode number in entry at offset 184...
...

The output of these later runs is huge (~20G in at least one case) and I 
had to interrupt a couple of attempts because I'd been writing the output 
to the root filesystem which filled up.

Anyway all of the later runs now end with:

...
disconnected dir inode 3892327224, moving to lost+found
disconnected dir inode 3892327225, moving to lost+found
disconnected dir inode 3892327226, moving to lost+found
disconnected dir inode 3892327227, moving to lost+found
disconnected dir inode 3892327229, moving to lost+found
disconnected dir inode 3892327231, moving to lost+found
Phase 7 - verify and correct link counts...
resetting inode 256 nlinks from 8 to 5
resetting inode 261 nlinks from 2 to 13006001
xfs_repair: phase7.c:47: set_nlinks: Assertion `fs_inode_nlink' failed.


Now in phase7.c it asserts if nlinks is over 65536 which 13006001 clearly 
is:

            do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
                    ino, dinoc->di_nlink, nrefs);

            if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
                    ASSERT(fs_inode_nlink);
                    do_warn(
_("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to version 2\n"),
                            nrefs, ino);

            }
            dinoc->di_nlink = nrefs;

I'm not sure if this is the same thing mentioned in doc/CHANGES about 
nlinks overflowing 8-bits (in this case it is overflowing 16-bits), though 
I do wonder what would happen if I simply commented out that ASSERT - 
the do_warn is probably there for a reason but I can't see how it can be 
reached...

I'm guessing that attempting to move so many files into lost+found is 
failing.  Nor am I really sure what happened which caused it to lose the 
directory entries for so many inodes.

Mounting the fs now shows almost nothing, and worryingly the df output 
shows that the number of inodes in use has gone down by a lot - was ~60M 
inodes in use and now shows as 49M though that may simply be because 13M 
should be in lost+found ...

Have I completely destroyed this filesystem or is there any hope of 
getting any of the files back ? (all the error messages I have seen were 
about problems with the directories so some or all of the files and 
structures may still be present)...

If it is destroyed (it only contained backup trees so I can live with it 
being lost), what should I have done differently?  ie what was my first 
mistake ?

I'm hoping to at least learn something from what went wrong.

I ran an xfs_metadump but the result is pretty big - 12G - while running 
it seems to only think there are going to be ~23M inodes in the dump, 
maybe that number changes later.

Is there some fraction of this dump which would be of any use for any 
debugging ?

-- 
/--------------------------------------------------------------------\
| "Computers are different from telephones.  Computers do not ring." |
|       -- A. Tanenbaum, "Computer Networks", p. 32                  |
---------------------------------------------------------------------|
| Jon Peatfield, _Computer_ Officer, DAMTP,  University of Cambridge |
| Mail:  jp107@damtp.cam.ac.uk     Web:  http://www.damtp.cam.ac.uk/ |
\--------------------------------------------------------------------/

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Assert in xfs_repair (Phase 7) and other xfs_restore problems
  2012-07-20 20:59 Assert in xfs_repair (Phase 7) and other xfs_restore problems Jon Peatfield
@ 2012-07-23 17:47 ` Jon Peatfield
  2012-07-24  0:01   ` Dave Chinner
  2012-07-23 23:54 ` Dave Chinner
  1 sibling, 1 reply; 6+ messages in thread
From: Jon Peatfield @ 2012-07-23 17:47 UTC (permalink / raw)
  To: xfs; +Cc: Jon Peatfield

Just askign the last question again in case the earlier summary data put 
people off reading it...


On Fri, 20 Jul 2012, Jon Peatfield wrote:
...
> Anyway all of the later runs now end with:
>
> ...
> disconnected dir inode 3892327224, moving to lost+found
> disconnected dir inode 3892327225, moving to lost+found
> disconnected dir inode 3892327226, moving to lost+found
> disconnected dir inode 3892327227, moving to lost+found
> disconnected dir inode 3892327229, moving to lost+found
> disconnected dir inode 3892327231, moving to lost+found
> Phase 7 - verify and correct link counts...
> resetting inode 256 nlinks from 8 to 5
> resetting inode 261 nlinks from 2 to 13006001
> xfs_repair: phase7.c:47: set_nlinks: Assertion `fs_inode_nlink' failed.
>
>
> Now in phase7.c it asserts if nlinks is over 65536 which 13006001 clearly is:
>
>            do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
>                    ino, dinoc->di_nlink, nrefs);
>
>            if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
>                    ASSERT(fs_inode_nlink);
>                    do_warn(
> _("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to 
> version 2\n"),
>                            nrefs, ino);
>
>            }
>            dinoc->di_nlink = nrefs;

...
> Have I completely destroyed this filesystem or is there any hope of getting 
> any of the files back ? (all the error messages I have seen were about 
> problems with the directories so some or all of the files and structures may 
> still be present)...
>
> If it is destroyed (it only contained backup trees so I can live with it 
> being lost), what should I have done differently?  ie what was my first 
> mistake ?
>
> I'm hoping to at least learn something from what went wrong.
...

So can I get xfs_repair to either put the ~13M disconnected files into 
lost+found or somewhere else ?  Does it matter that lost+found does not 
already exist?

  -- Jon

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Assert in xfs_repair (Phase 7) and other xfs_restore problems
  2012-07-20 20:59 Assert in xfs_repair (Phase 7) and other xfs_restore problems Jon Peatfield
  2012-07-23 17:47 ` Jon Peatfield
@ 2012-07-23 23:54 ` Dave Chinner
  2012-07-24 18:28   ` Jon Peatfield
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Chinner @ 2012-07-23 23:54 UTC (permalink / raw)
  To: Jon Peatfield; +Cc: xfs

On Fri, Jul 20, 2012 at 09:59:11PM +0100, Jon Peatfield wrote:
> I have been trying and failing to repair an xfs filesystem.
> Originally I was using the Scientific-Linux (like RHEL) provided
> xfs_repair (2.9.4) but when that failed I built the latest tarball
> (3.1.8)...

So it's an old filesystem, and you had some unknown corruption
event.

> Anyway all of the later runs now end with:
> 
> ...
> disconnected dir inode 3892327224, moving to lost+found
> disconnected dir inode 3892327225, moving to lost+found
> disconnected dir inode 3892327226, moving to lost+found
> disconnected dir inode 3892327227, moving to lost+found
> disconnected dir inode 3892327229, moving to lost+found
> disconnected dir inode 3892327231, moving to lost+found
> Phase 7 - verify and correct link counts...
> resetting inode 256 nlinks from 8 to 5
> resetting inode 261 nlinks from 2 to 13006001
> xfs_repair: phase7.c:47: set_nlinks: Assertion `fs_inode_nlink' failed.

It's trying to set the link count to ~13M.

> Now in phase7.c it asserts if nlinks is over 65536 which 13006001
> clearly is:
> 
>            do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
>                    ino, dinoc->di_nlink, nrefs);
> 
>            if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
>                    ASSERT(fs_inode_nlink);
>                    do_warn(
> _("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to version 2\n"),
>                            nrefs, ino);
> 
>            }
>            dinoc->di_nlink = nrefs;

And that is saying that your superblock does not have the NLINK
feature bit set, so it can't use version 2 inodes which support link
counts of up to 2^32.  Use xfs_db to set the NLINK bit, and re-run
repair.

FWIW, the mkfs default is to set the NLINK. That got changed some
4-5 years ago, IIRC...

> Mounting the fs now shows almost nothing, and worryingly the df
> output shows that the number of inodes in use has gone down by a lot
> - was ~60M inodes in use and now shows as 49M though that may simply
> be because 13M should be in lost+found ...

Yes, those 13M inodes are still disconnected because lost+found
couldn't reference them all.

> Have I completely destroyed this filesystem or is there any hope of
> getting any of the files back ? (all the error messages I have seen
> were about problems with the directories so some or all of the files
> and structures may still be present)...

Possibly.

> If it is destroyed (it only contained backup trees so I can live
> with it being lost), what should I have done differently?  ie what
> was my first mistake ?

Always keep your filesystem tools up to date, and not running a
trial reapir on a metadump image to find out what the damage was
before your tried to repair it on your only copy. Indeed, if it's
only 3TB of filesystem, you coul dhave easily spent a coupl eof
hundred dollars on a single disk and imaged the entire broken
filesystem before doing anything else....

> I ran an xfs_metadump but the result is pretty big - 12G - while
> running it seems to only think there are going to be ~23M inodes in
> the dump, maybe that number changes later.
> 
> Is there some fraction of this dump which would be of any use for
> any debugging ?

Probably not at this point.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Assert in xfs_repair (Phase 7) and other xfs_restore problems
  2012-07-23 17:47 ` Jon Peatfield
@ 2012-07-24  0:01   ` Dave Chinner
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Chinner @ 2012-07-24  0:01 UTC (permalink / raw)
  To: Jon Peatfield; +Cc: xfs

On Mon, Jul 23, 2012 at 06:47:43PM +0100, Jon Peatfield wrote:
> Just askign the last question again in case the earlier summary data
> put people off reading it...

Keep in mind when you sent it:

Fri, 20 Jul 2012 21:59:11 +0100 (BST)

Late on Friday evening. I, for one, like to get away from filesytems
on my weekends and sometimes there's a lot on Monday to catch up
on... :P

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Assert in xfs_repair (Phase 7) and other xfs_restore problems
  2012-07-23 23:54 ` Dave Chinner
@ 2012-07-24 18:28   ` Jon Peatfield
  2012-07-24 21:41     ` Dave Chinner
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Peatfield @ 2012-07-24 18:28 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Jon Peatfield, xfs

On Tue, 24 Jul 2012, Dave Chinner wrote:

...
>> Now in phase7.c it asserts if nlinks is over 65536 which 13006001
>> clearly is:
>>
>>            do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
>>                    ino, dinoc->di_nlink, nrefs);
>>
>>            if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
>>                    ASSERT(fs_inode_nlink);
>>                    do_warn(
>> _("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to version 2\n"),
>>                            nrefs, ino);
>>
>>            }
>>            dinoc->di_nlink = nrefs;
>
> And that is saying that your superblock does not have the NLINK
> feature bit set, so it can't use version 2 inodes which support link
> counts of up to 2^32.  Use xfs_db to set the NLINK bit, and re-run
> repair.
>
> FWIW, the mkfs default is to set the NLINK. That got changed some
> 4-5 years ago, IIRC...

Thanks for this.

The original filesystem is about 8 years old so it would have been created 
before that change even if we had the latest versions of the xfsprogs at 
the time.

While waiting for the data to copy (before I try anything else) I did a 
quick scan though the xfsprogs 3.1.8 sources looking for things which 
alter the sb version/versionnum to set the XFS_SB_VERSION_NLINKBIT flag 
(assuming that one it right since it is what causes xfs_db to add NLINK to 
the version output).

I can find only one piece of code which does it:

include/xfs_sb.h :
static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
{
         if (sbp->sb_versionnum <= XFS_SB_VERSION_2)
                 sbp->sb_versionnum = XFS_SB_VERSION_3;
         else
                 sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT;
}

and that function is only used in one place - and can't be reached:

repair/versions.c :
         if (fs_inode_nlink && !xfs_sb_version_hasnlink(sb))  {
                 ASSERT(fs_inode_nlink_allowed);
                 xfs_sb_version_addnlink(sb);
         }
...

Am I missing the obvious way to set this bit?

BTW on a fresh fs made with and older mkfs.xfs (the one from RHEL5) the 
NLINK bit isn't set initially but seems to become set once I cause an 
inode to have more than 65536 links...

# xfs_db -c version /dev/SpudSnaps/Test2
versionnum [0xb584+0x8] = V4,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2
# mount /dev/SpudSnaps/Test2 /mnt/testing/
# mkdir /mnt/testing/foo
# for i in $(seq 1 65537); do mkdir /mnt/testing/foo/$i; done
# umount /mnt/testing
# xfs_db -c version /dev/SpudSnaps/Test2
versionnum [0xb5b4+0x8] = V4,ATTR,NLINK,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2

So is it actually some other feature which needs to be set to allow NLINK 
to be set?

Looking at the 'bad' fs it has:

# xfs_db -c version /dev/FornixRaid02/damtp-home
versionnum [0x35d4+0x0] = V4,ATTR,QUOTA,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG

so it seems to just be missing MOREBITS and ATTR2 compared to the earlier 
output from the test fs - but neither seems very likely.

I'm sure that I'm missing something very obvious.

  -- Jon

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Assert in xfs_repair (Phase 7) and other xfs_restore problems
  2012-07-24 18:28   ` Jon Peatfield
@ 2012-07-24 21:41     ` Dave Chinner
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Chinner @ 2012-07-24 21:41 UTC (permalink / raw)
  To: Jon Peatfield; +Cc: xfs

On Tue, Jul 24, 2012 at 07:28:48PM +0100, Jon Peatfield wrote:
> On Tue, 24 Jul 2012, Dave Chinner wrote:
> 
> ...
> >>Now in phase7.c it asserts if nlinks is over 65536 which 13006001
> >>clearly is:
> >>
> >>           do_warn(_("resetting inode %" PRIu64 " nlinks from %u to %u\n"),
> >>                   ino, dinoc->di_nlink, nrefs);
> >>
> >>           if (dinoc->di_version == 1 && nrefs > XFS_MAXLINK_1)  {
> >>                   ASSERT(fs_inode_nlink);
> >>                   do_warn(
> >>_("nlinks %u will overflow v1 ino, ino %" PRIu64 " will be converted to version 2\n"),
> >>                           nrefs, ino);
> >>
> >>           }
> >>           dinoc->di_nlink = nrefs;
> >
> >And that is saying that your superblock does not have the NLINK
> >feature bit set, so it can't use version 2 inodes which support link
> >counts of up to 2^32.  Use xfs_db to set the NLINK bit, and re-run
> >repair.
> >
> >FWIW, the mkfs default is to set the NLINK. That got changed some
> >4-5 years ago, IIRC...
> 
> Thanks for this.
> 
> The original filesystem is about 8 years old so it would have been
> created before that change even if we had the latest versions of the
> xfsprogs at the time.

....

> Am I missing the obvious way to set this bit?

xfs_repair shouldn't set or clear feature bits unless asked, and
this case is someting we haven't seen before. I can't recall ever
having seen this, even when nlink wasn't set by default....

xfs_db is the answer. i.e.

# xfs_db -x -c version nlink <dev>
versionnum [0xb584+0x8] = V4,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2

take the first version 0xb584, and or the nlink bit in:

#define XFS_SB_VERSION_NLINKBIT         0x0020

to give 0xb5a4, and run the command:

# xfs_db -x -c "sb 0" -c "write versionnum 0xb5a4" <dev>

And that will set the bit in the superblock and allow repair to
handle inodes with more than 64k links.

> BTW on a fresh fs made with and older mkfs.xfs (the one from RHEL5)
> the NLINK bit isn't set initially but seems to become set once I
> cause an inode to have more than 65536 links...

Right - that's the dynamic behaviour I mentioned.

> # xfs_db -c version /dev/SpudSnaps/Test2
> versionnum [0xb584+0x8] = V4,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2
> # mount /dev/SpudSnaps/Test2 /mnt/testing/
> # mkdir /mnt/testing/foo
> # for i in $(seq 1 65537); do mkdir /mnt/testing/foo/$i; done
> # umount /mnt/testing
> # xfs_db -c version /dev/SpudSnaps/Test2
> versionnum [0xb5b4+0x8] = V4,ATTR,NLINK,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2
> 
> So is it actually some other feature which needs to be set to allow
> NLINK to be set?

No, the kernel does it automatically. Like I said, old mkfs.xfs
binaries did not set the bit, relying on the kernel to automatically
add it when necessary. i.e. going back 15 years, you could upgrade
your Irix kernel an magically get >64k link count support in XFS
without doing anything else...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-24 21:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-20 20:59 Assert in xfs_repair (Phase 7) and other xfs_restore problems Jon Peatfield
2012-07-23 17:47 ` Jon Peatfield
2012-07-24  0:01   ` Dave Chinner
2012-07-23 23:54 ` Dave Chinner
2012-07-24 18:28   ` Jon Peatfield
2012-07-24 21:41     ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.