Skip to contentSkip to conversation

strange behavior of a larger xfs directory

DISCUSSION Hans-Peter Jansen 2 participants 8 messages Mar 4, 2013 – Mar 6, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi,

after upgrading the kernel on a server from 2.6.34 to 3.8.1 (x86-32), I suffer from a strange behavior of a larger directory, that a downgrade of the kernel cannot repair.

The best way to reproduce the problem is cd into that directory and running "vi .". It should display a full directory listing, but it only displays a about dozen entries. Another way is just using bash tab completion (e.g. ls <tab><tab> should display a screenful of items, but only shows the very same dozen of entries. Userspace is quite old (openSUSE 11.1/i586, but I cannot upgrade to a newer userspace for a couple of reasons. OTOH, a simple ls displays the full list again, as well as does a simple python script:

import os
for i in os.listdir("/video/video"):

	 print i, os.lstat(os.path.join("/video/video", i))

As far as I understand Linux, this kind of kernel upgrade should work just fine (minus the usual udev fallout, that isn't an issue for a server (this one at least). Everything is working fine so far, bind, dhcpd, samba, NFS3 (homes are mounted from it), postfix, cyrus imapd, mysql (with many databases), ntp, you name it. It is also serving vdr video streams and records, and its record directory is the one, that shows the issues, resulting in some displeasure in my family.

stracing the vi call reveals

27177 open("/video/video/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 27177 fstat64(3, {st_dev=makedev(8, 65), st_ino=357, st_mode=S_IFDIR|0775, st_nlink=350,

              st_uid=223, st_gid=33, st_blksize=4096, st_blocks=40, st_size=16384, 
              st_atime=2013/03/04-16:12:37, st_mtime=2013/03/04-16:17:52, 
              st_ctime=2013/03/04-16:17:52}) = 0
27177 getdents64(3, {
              {d_ino=357, d_off=4, d_type=DT_UNKNOWN, d_reclen=24, d_name="."} 
              {d_ino=128, d_off=6, d_type=DT_UNKNOWN, d_reclen=24, d_name=".."} 
              {d_ino=367, d_off=12, d_type=DT_UNKNOWN, d_reclen=56, d_name="%Avatar_-_Aufbruch_nach_Pandora"} 
              {d_ino=368, d_off=18, d_type=DT_UNKNOWN, d_reclen=56, d_name="%Der_Deutsche_Comedy_Preis_2009"}
              [...]
              {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"}
              [...]}) = 4072

# note: including items, that are missing later on, probably all

27177 _llseek(3, 74, [74], SEEK_SET) = 0

# now a couple of stat64 calls of entries that are displayed later

27177 stat64("/video/video/%Avatar_-_Aufbruch_nach_Pandora", {st_dev=makedev(8, 65),

             st_ino=367, st_mode=S_IFDIR|0755, st_nlink=3, st_uid=223, st_gid=33, 
             st_blksize=4096, st_blocks=0, st_size=39, st_atime=2013/03/04-07:49:20, 
             st_mtime=2011/02/03-23:21:08, st_ctime=2011/09/10-17:55:32}) = 0
27177 stat64("/video/video/%Avatar_-_Aufbruch_nach_Pandora", {st_dev=makedev(8, 65), 
             st_ino=367, st_mode=S_IFDIR|0755, st_nlink=3, st_uid=223, st_gid=33, 
             st_blksize=4096, st_blocks=0, st_size=39, st_atime=2013/03/04-07:49:20, 
             st_mtime=2011/02/03-23:21:08, st_ctime=2011/09/10-17:55:32}) = 0
27177 stat64("/video/video/%Avatar_-_Aufbruch_nach_Pandora", {st_dev=makedev(8, 65), 
             st_ino=367, st_mode=S_IFDIR|0755, st_nlink=3, st_uid=223, st_gid=33, 
             st_blksize=4096, st_blocks=0, st_size=39, st_atime=2013/03/04-07:49:20, 
             st_mtime=2011/02/03-23:21:08, st_ctime=2011/09/10-17:55:32}) = 0

[...]

# then it preceeds with getdents64 and fetches already fetched entries
27177 getdents64(3, {
             {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"} 
				  [...]}) = 4088

27177 close(3) = 0

This looks silly. Shouldn't getdent64 only return not yet processed entries?

Full trace is available here: ftp://urpla.net/video.trc

xfs-info:

meta-data=/dev/sde1              isize=256    agcount=5, agsize=268435455 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=1098632439, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=521728, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

xfs_repair (3.1.6) doesn't choke on any errors.

Could some kind soul with more insight shed some light on this issue?

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

#1 lore raw

Am Montag, 4. März 2013, 17:40:13 schrieb Hans-Peter Jansen:

Quoted 13 lines

Hi,

after upgrading the kernel on a server from 2.6.34 to 3.8.1 (x86-32), I suffer from a strange behavior of a larger directory, that a downgrade of the kernel cannot repair.

The best way to reproduce the problem is cd into that directory and running "vi .". It should display a full directory listing, but it only displays a about dozen entries. Another way is just using bash tab completion (e.g. ls <tab><tab> should display a screenful of items, but only shows the very same dozen of entries. Userspace is quite old (openSUSE 11.1/i586, but I cannot upgrade to a newer userspace for a couple of reasons. OTOH, a simple ls displays the full list again,

[...]

Quoted 4 lines
Quoted 1 line
# then it preceeds with getdents64 and fetches already fetched entries
27177 getdents64(3, {
             {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"} 

Okay, this is the culprit: 0x1007F977F overflows 32 bit, although I *never* mounted anything with inode64 option.

For some reason, the intermediate kernel 3.8.0 has used the inode64 version by *default*. This breaks bash tab completion and vdr. After forcing the inode32 option and copying some offenders away and back in place, the issue vanishes.

Unlike stated in the XFS FAQs, openSUSE 11.1 *has* issues with inode64, and even more so, if enabled by default.

I will hack up a script now, that copes with this mess.

Cheers,
Pete

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

#2 lore raw
Quoted 25 lines · Hans-Peter Jansen

Am Montag, 4. März 2013, 17:40:13 schrieb Hans-Peter Jansen:

Quoted 13 lines

Hi,

after upgrading the kernel on a server from 2.6.34 to 3.8.1 (x86-32), I suffer from a strange behavior of a larger directory, that a downgrade of the kernel cannot repair.

The best way to reproduce the problem is cd into that directory and running "vi .". It should display a full directory listing, but it only displays a about dozen entries. Another way is just using bash tab completion (e.g. ls <tab><tab> should display a screenful of items, but only shows the very same dozen of entries. Userspace is quite old (openSUSE 11.1/i586, but I cannot upgrade to a newer userspace for a couple of reasons. OTOH, a simple ls displays the full list again,

[...]

Quoted 4 lines
Quoted 1 line
# then it preceeds with getdents64 and fetches already fetched entries
27177 getdents64(3, {
             {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"} 

Okay, this is the culprit: 0x1007F977F overflows 32 bit, although I *never* mounted anything with inode64 option.

Quoted 7 lines

For some reason, the intermediate kernel 3.8.0 has used the inode64 version by *default*. This breaks bash tab completion and vdr. After forcing the inode32 option and copying some offenders away and back in place, the issue vanishes.

Unlike stated in the XFS FAQs, openSUSE 11.1 *has* issues with inode64, and even more so, if enabled by default.

Wonderful. Report a bug to OpenSuSE and get userspace fixed. It's only a matter of time before btrfs and ext4 users start reporting the same problem, as they also use 64 bit inode numbers....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw
In reply to Hans-Peter Jansen
Quoted 5 lines · Hans-Peter Jansen

Hi,

after upgrading the kernel on a server from 2.6.34 to 3.8.1 (x86-32), I suffer from a strange behavior of a larger directory, that a downgrade of the kernel cannot repair.

TL;DR: problem with an old userspace and 64 bit inodes.

Quoted 12 lines

27177 open("/video/video/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 27177 fstat64(3, {st_dev=makedev(8, 65), st_ino=357, st_mode=S_IFDIR|0775, st_nlink=350,

              st_uid=223, st_gid=33, st_blksize=4096, st_blocks=40, st_size=16384, 
              st_atime=2013/03/04-16:12:37, st_mtime=2013/03/04-16:17:52, 
              st_ctime=2013/03/04-16:17:52}) = 0
27177 getdents64(3, {
              {d_ino=357, d_off=4, d_type=DT_UNKNOWN, d_reclen=24, d_name="."} 
              {d_ino=128, d_off=6, d_type=DT_UNKNOWN, d_reclen=24, d_name=".."} 
              {d_ino=367, d_off=12, d_type=DT_UNKNOWN, d_reclen=56, d_name="%Avatar_-_Aufbruch_nach_Pandora"} 
              {d_ino=368, d_off=18, d_type=DT_UNKNOWN, d_reclen=56, d_name="%Der_Deutsche_Comedy_Preis_2009"}
              [...]
              {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"}

That's a 64 bit inode number right there (0x0x1007F977F), and AFAICT it's the only one in the directory. That was created when you were running 3.8.1.

Quoted 4 lines
              [...]}) = 4072

# note: including items, that are missing later on, probably all

27177 _llseek(3, 74, [74], SEEK_SET) = 0

Smoking gun. That is effectively setting the directory offset to 74 (XFS masks out the upper 32 bits of the directory position because it is invalid) and so XFS will take that offset and walk to the next valid dirent and start filling entries from there on the next getdents64 call. Your filesystem is doing exactly what userspace is asking it to do.

Ah, I note that all the stat64() calls that follow stop at the dirent that is at d_off=74. So it appears that userspace is having some kind of problem related to the above entry.

Quoted 4 lines
# then it preceeds with getdents64 and fetches already fetched entries
27177 getdents64(3, {
             {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32, d_name="Black_Swan"} 
                                  ^^^^^^^^

And the next valid entry in the directory is offset=78.

So, what it looks like to me is that whatever is parsing the linux_dirent returned by the getdents64() call is choking on the 64 bit inode number.

Now, given that strace is parsing it correctly, this implies that whatever is issuing the getdents64 call is not parsing the linux_dirent64 structure correctly. In fact, I suspect what is happening is that userspace is incorrectly using a struct linux_dirent to parse the results and hence it's seeing d_off/d_type/d_reclen being invalid due to the resultant structure misalignment.

Further, this is being seen by multiple different vectors, which indicates that it is probably the readdir() glibc call that is buggy, and not any of the applications.

First solution: upgrade to a modern userspace.

Second solution: Run 3.8.1, make sure you mount with inode32, and then run the xfs_reno tool mentioned on this page:

http://xfs.org/index.php/Unfinished_work

to find all the inodes with inode numbers larger than 32 bits and move them to locations with smaller inode numbers.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Hi Dave,

thanks for the helpful hints.

Am Dienstag, 5. März 2013, 10:05:27 schrieb Dave Chinner:

Quoted 9 lines · Hans-Peter Jansen
Quoted 5 lines

Hi,

after upgrading the kernel on a server from 2.6.34 to 3.8.1 (x86-32), I suffer from a strange behavior of a larger directory, that a downgrade of the kernel cannot repair.

TL;DR: problem with an old userspace and 64 bit inodes.

[...]

Quoted 23 lines
Quoted 7 lines
# then it preceeds with getdents64 and fetches already fetched entries

27177 getdents64(3, {

             {d_ino=4303329151, d_off=78, d_type=DT_UNKNOWN, d_reclen=32,
             d_name="Black_Swan"}
                                  ^^^^^^^^

And the next valid entry in the directory is offset=78.

So, what it looks like to me is that whatever is parsing the linux_dirent returned by the getdents64() call is choking on the 64 bit inode number.

Now, given that strace is parsing it correctly, this implies that whatever is issuing the getdents64 call is not parsing the linux_dirent64 structure correctly. In fact, I suspect what is happening is that userspace is incorrectly using a struct linux_dirent to parse the results and hence it's seeing d_off/d_type/d_reclen being invalid due to the resultant structure misalignment.

Quoted 3 lines

Further, this is being seen by multiple different vectors, which indicates that it is probably the readdir() glibc call that is buggy, and not any of the applications.

Well, than the python script and ls should fall flat on their faces, which they do not.. Also such a blatant misinterpretation should cause more havoc, but most other stat values seem to match expectations.

Some kind of subtle wreckage happens here..

Quoted 1 line

First solution: upgrade to a modern userspace.

I wish, but I cannot ATM.

Quoted 7 lines

Second solution: Run 3.8.1, make sure you mount with inode32, and then run the xfs_reno tool mentioned on this page:

http://xfs.org/index.php/Unfinished_work

to find all the inodes with inode numbers larger than 32 bits and move them to locations with smaller inode numbers.

Okay, I would like to take that route.

I've updated the xfsprogs, xfsdump and xfstests packages in my openSUSE build service repo home:frispete:tools to current versions today, and plan to submit them to Factory. openSUSE is always lagging in this area.

I've tried to include a build of the xfs_reno tool in xfsprogs, since, as you mentioned, others might have a similar need soon. Unfortunately I failed so far, because it is using some attr_multi and attr_list interfaces, that aren't part of the xfsprogs visible API anymore. Only the handle(3) man page refers to them.

Attached is my current state: I've relocated the patch to xfsprogs 3.1.9, because it already carries all the necessary headers (apart from attr_multi and attr_list). The attr interfaces seem to be collected in libhandle now, hence I've added it to the build.

But now I'm stuck. It's not obvious for me, how the attr_multi_by_handle and attr_list_by_handle are supposed to replace the ones that xfs_reno uses, and documentation of this stuff is, hmm, sparse..

Could somebody with deeper insight have a look?

TIA && cheers,
Pete

From:       "Barry Naujok" <bnaujok () sgi ! com>
Date:       2007-10-04 4:25:16
Message-ID: op.tznnweh23jf8g2 () pc-bnaujok ! melbourne ! sgi ! com

The attached tool allows an inode64 filesystem to be converted to inode32. For this to work, the filesystem has to be mounted inode32 before it's run.

Relocated to xfsprogs by H.P. Jansen

man/man8/xfs_reno.8 new file +117 -0
Index: b/man/man8/xfs_reno.8
===================================================================
@@ -0,0 +1,117 @@
+.TH xfs_reno 8
+.SH NAME
+xfs_reno \- renumber XFS inodes
+.SH SYNOPSIS
+.B xfs_reno
+[
+.B \-fnpqv
+] [
+.B \-P
+.I interval
+]
+.I path
+.br
+.B xfs_reno \-r
+.I recover_file
+.SH DESCRIPTION
+.B xfs_reno
+is applicable only to XFS filesystems.
+.PP
+.B xfs_reno
+renumbers inodes. XFS supports 64-bit inode numbers, although by
+default it will avoid creating inodes with numbers greater than
+what can be contained within a 32-bit number. If a filesystem does
+contain inode numbers greater than 32-bits, then this can conflict with
+applications that do not support them.
+To recover from this situation previously, affected files would need
+to be copied (and so get a new inode number) and the old version
+removed. This can be time consuming and impractical for very large
+files and filesystems.
+.B xfs_reno
+can be used to renumber such inodes quickly.
+.B xfs_reno
+will copy the inodes of affected files and move the data from the old
+inode to the new without having to copy the data.
+.B xfs_reno
+relies on XFS in the kernel to allocate a new inode number, so if the
+filesystem has been mounted with the
+.I inode64
+mount option, the new inodes will quite possibly have inode numbers
+greater than 32-bits.
+.PP
+.B xfs_reno
+should only be used on a filesystem where it is necessary to
+renumber inodes. Use of
+.B xfs_reno
+on a regular basis is
+.IR "not recommended" .
+Apart from application compatibility, there is no particular advantage
+to be had from renumbering inodes.
+.PP
+.B xfs_reno
+works by traversing a directory tree, scanning all the directories
+and noting which files require renumbering. Once the scanning phase
+is done, it will process the appropriate files and directories. The
+directory's absolute pathname must be given to
+.BR xfs_reno .
+The following options are accepted by
+.BR xfs_reno .
+.TP
+.B \-f
+Force conversion on all inodes, rather than just those with a 64-bit
+inode number. This is not particularly useful except for debugging
+purposes.
+.TP
+.B \-n
+Do nothing, perform a trial run.
+.TP
+.B \-v
+Increases the verbosity of progress and error messages.  Additional
+.BR \-v 's
+can be used to further increase verbosity.
+.TP
+.B \-q
+Do not report progress, only errors.
+.TP
+.B \-p
+Show progress status.
+.TP
+.BI \-P " seconds"
+Set the interval for the progress status in seconds.  The default is 1
+second.
+.TP
+.B \-r
+Recover from an interrupted run.  If
+.B xfs_reno
+is interrupted, it will leave a file called
+.I xfs_reno.recover
+in the directory specified on the command line.  This file will
+contain enough information so that
+.B xfs_reno
+can either finish processing the file it was working on when
+interrupted or back out the last change it made, depending on how far
+through the process it had progressed.
+.B xfs_reno
+will only recover the single file it was working on so it will need
+to be run again on the directory to be sure that all the appropriate
+inodes have been converted.
+.SH EXAMPLES
+To renumber inodes with 64-bit inode numbers:
+.IP
+.B # xfs_reno -p /path/to/directory
+.PP
+To recover from an interrupted run:
+.IP
+.B # xfs_reno -r /path/to/directory/xfs_reno.recover
+.PP
+.SH FILES
+.PD
+.TP
+.I /path/xfs_reno.recover
+records the state where renumbering was interrupted.
+.PD
+.SH SEE ALSO
+.BR xfs_fsr (8),
+.BR xfs_ncheck (8),
+.BR fstab (5),
+.BR xfs (5).
reno/Makefile new file +19 -0
Index: b/reno/Makefile
===================================================================
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
+#
+
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+LTCOMMAND = xfs_reno
+CFILES = xfs_reno.c
+LLDLIBS = $(LIBATTR)
+
+default: $(LTCOMMAND)
+
+include $(BUILDRULES)
+
+install: default
+	$(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
+	$(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
+install-dev:
reno/xfs_reno.c new file +2040 -0

2,040 lines not on this page · raw message

Makefile +1 -1
Index: b/Makefile
===================================================================
@@ -41,7 +41,7 @@ endif
 
 LIB_SUBDIRS = libxfs libxlog libxcmd libhandle libdisk
 TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
-		mdrestore repair rtcp m4 man doc po debian
+		mdrestore repair reno rtcp m4 man doc po debian
 
 SUBDIRS = include $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
 
Makefile +1 -1
Index: b/Makefile
===================================================================
@@ -56,7 +56,7 @@ endif
 $(LIB_SUBDIRS) $(TOOL_SUBDIRS): include
 copy mdrestore: libxfs
 db logprint: libxfs libxlog
-fsr: libhandle
+fsr reno: libhandle
 growfs: libxfs libxcmd
 io: libxcmd libhandle
 mkfs: libxfs
reno/Makefile +1 -1
Index: b/reno/Makefile
===================================================================
@@ -7,7 +7,7 @@ include $(TOPDIR)/include/builddefs
 
 LTCOMMAND = xfs_reno
 CFILES = xfs_reno.c
-LLDLIBS = $(LIBATTR)
+LLDLIBS = $(LIBATTR) $(LIBHANDLE)
 
 default: $(LTCOMMAND)
 
reno/xfs_reno.c +1 -0
Index: b/reno/xfs_reno.c
===================================================================
@@ -49,6 +49,7 @@
 #include <attr/attributes.h>
 #include <xfs/xfs_dfrag.h>
 #include <xfs/xfs_inum.h>
+#include <xfs/handle.h>
 
 #define ATTRBUFSIZE	1024
 

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

#5 lore raw
Quoted 22 lines · Hans-Peter Jansen

Am Dienstag, 5. März 2013, 10:05:27 schrieb Dave Chinner:

Quoted 8 lines · Hans-Peter Jansen

Second solution: Run 3.8.1, make sure you mount with inode32, and then run the xfs_reno tool mentioned on this page:

http://xfs.org/index.php/Unfinished_work

to find all the inodes with inode numbers larger than 32 bits and move them to locations with smaller inode numbers.

Okay, I would like to take that route.

I've updated the xfsprogs, xfsdump and xfstests packages in my openSUSE build service repo home:frispete:tools to current versions today, and plan to submit them to Factory. openSUSE is always lagging in this area.

I've tried to include a build of the xfs_reno tool in xfsprogs, since, as you mentioned, others might have a similar need soon. Unfortunately I failed so far, because it is using some attr_multi and attr_list interfaces, that aren't part of the xfsprogs visible API anymore. Only the handle(3) man page refers to them.

Quoted 4 lines

Attached is my current state: I've relocated the patch to xfsprogs 3.1.9, because it already carries all the necessary headers (apart from attr_multi and attr_list). The attr interfaces seem to be collected in libhandle now, hence I've added it to the build.

attr_list and attr_multi are supplied by libattr, you should not need the *by_handle variants at all - they are special sauce used by xfsdump, not xfs_reno....

.....

reno/Makefile line 10

Quoted 6 lines
reno/Makefile new file +6 -0
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+LTCOMMAND = xfs_reno
+CFILES = xfs_reno.c
+LLDLIBS = $(LIBATTR)

The patch assumes that libattr has been found by autoconf and set up in $(LIBATTR), but xfsprogs does not currently use libattr and hence that variable isn't set up. Therefore this line is a no-op:

+LLDLIBS = $(LIBATTR)

Change it to:

LLDLIBS = -lattr

And the xfs_reno should then link.

BTW, if you want extra points and add the autoconf magic to the patch, copy it from the xfsdump tree. The places you need to copy from are:

$ git grep -l LIBATTR |grep -v Makefile
configure.ac
include/builddefs.in
m4/package_attrdev.m4
$

And for even more bonus points, you could write a basic xfstest that creates a bunch of 64 bit inodes and then runs xfs_reno on it and checks that they get moved to 32 bit inodes. At that point, we could probably pull the xfs_reno patch into xfsprogs and ship it....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Am Mittwoch, 6. März 2013, 09:29:41 schrieb Dave Chinner:

Quoted 29 lines · Hans-Peter Jansen
Quoted 22 lines

Am Dienstag, 5. März 2013, 10:05:27 schrieb Dave Chinner:

Quoted 8 lines · Hans-Peter Jansen

Second solution: Run 3.8.1, make sure you mount with inode32, and then run the xfs_reno tool mentioned on this page:

http://xfs.org/index.php/Unfinished_work

to find all the inodes with inode numbers larger than 32 bits and move them to locations with smaller inode numbers.

Okay, I would like to take that route.

I've updated the xfsprogs, xfsdump and xfstests packages in my openSUSE build service repo home:frispete:tools to current versions today, and plan to submit them to Factory. openSUSE is always lagging in this area.

I've tried to include a build of the xfs_reno tool in xfsprogs, since, as you mentioned, others might have a similar need soon. Unfortunately I failed so far, because it is using some attr_multi and attr_list interfaces, that aren't part of the xfsprogs visible API anymore. Only the handle(3) man page refers to them.

Quoted 5 lines

Attached is my current state: I've relocated the patch to xfsprogs 3.1.9, because it already carries all the necessary headers (apart from attr_multi
and attr_list). The attr interfaces seem to be collected in libhandle now, hence I've added it to the build.

Quoted 3 lines

attr_list and attr_multi are supplied by libattr, you should not need the *by_handle variants at all - they are special sauce used by xfsdump, not xfs_reno....

Ahh, I see. These interfaces cannot be exercised much, given that google didn't relate them to libattr prominently..

Quoted 25 lines

.....

Review

Quoted 6 lines
(quoted diff) +6 -0
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+LTCOMMAND = xfs_reno
+CFILES = xfs_reno.c
+LLDLIBS = $(LIBATTR)

The patch assumes that libattr has been found by autoconf and set up in $(LIBATTR), but xfsprogs does not currently use libattr and hence that variable isn't set up. Therefore this line is a no-op:

+LLDLIBS = $(LIBATTR)

Change it to:

LLDLIBS = -lattr

And the xfs_reno should then link.

BTW, if you want extra points and add the autoconf magic to the patch, copy it from the xfsdump tree. The places you need to copy from are:

Quoted 5 lines
$ git grep -l LIBATTR |grep -v Makefile
configure.ac
include/builddefs.in
m4/package_attrdev.m4
$

Done that up to this point ;-) Nice and easy. Committed, attached, and public build is on the way.

Dave, you made my day, ahem, night. Thank you very much.

To a casual consumer of this thread: go, grab the xfs_reno.patch in the preceding mail, and the attached patch, apply both to a current version of xfsprogs, build, and read man xfs_reno. Seriously.

Quoted 4 lines

And for even more bonus points, you could write a basic xfstest that creates a bunch of 64 bit inodes and then runs xfs_reno on it and checks that they get moved to 32 bit inodes. At that point, we could probably pull the xfs_reno patch into xfsprogs and ship it....

Hmm, any idea on how xfs can be tricked into generating 64 bit inodes without the need to create an excessive big test fs, or is this an accepted practice?

Note to myself: xfs_reno could use some mount option check. Forgot to remount one partition with inode32 and, consequently, moved the offending inodes to another 64 bit value..

Cheers,
Pete

configure.ac +4 -0
Index: b/configure.ac
===================================================================
@@ -101,6 +101,10 @@ AC_PACKAGE_NEED_UUIDCOMPARE
 AC_PACKAGE_NEED_PTHREAD_H
 AC_PACKAGE_NEED_PTHREADMUTEXINIT
 
+AC_PACKAGE_NEED_ATTRIBUTES_H
+AC_PACKAGE_NEED_ATTRIBUTES_MACROS
+AC_PACKAGE_NEED_ATTRGET_LIBATTR
+
 AC_HAVE_FADVISE
 AC_HAVE_MADVISE
 AC_HAVE_MINCORE
include/builddefs.in +1 -0
Index: b/include/builddefs.in
===================================================================
@@ -34,6 +34,7 @@ LIBTERMCAP = @libtermcap@
 LIBEDITLINE = @libeditline@
 LIBREADLINE = @libreadline@
 LIBBLKID = @libblkid@
+LIBATTR = @libattr@
 LIBXFS = $(TOPDIR)/libxfs/libxfs.la
 LIBXCMD = $(TOPDIR)/libxcmd/libxcmd.la
 LIBXLOG = $(TOPDIR)/libxlog/libxlog.la
m4/package_attrdev.m4 new file +79 -0

79 lines not on this page · raw message

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

#7 lore raw
Quoted 8 lines · Hans-Peter Jansen

Am Mittwoch, 6. März 2013, 09:29:41 schrieb Dave Chinner:

Quoted 4 lines · Hans-Peter Jansen

attr_list and attr_multi are supplied by libattr, you should not need the *by_handle variants at all - they are special sauce used by xfsdump, not xfs_reno....

Ahh, I see. These interfaces cannot be exercised much, given that google didn't relate them to libattr prominently..

Attributes are not widely used by applications for some reason...

Quoted 2 lines

Hmm, any idea on how xfs can be tricked into generating 64 bit inodes without the need to create an excessive big test fs, or is this an accepted practice?

The usual trick is to use a sparse loopback device and create the filesystem on that. see, for example, xfstests 078, where it is testing growfs on filesystems up to 16TB in size on a loopback device...

Quoted 3 lines

Note to myself: xfs_reno could use some mount option check. Forgot to remount one partition with inode32 and, consequently, moved the offending inodes to another 64 bit value..

I'd just use a wrapper script that checked /proc/mounts for the inode64 flag being set first....

....

configure.ac

Quoted 4 lines

Index: b/configure.ac
===================================================================

configure.ac +0 -0

....

The patch looks sane - can you add a commit description and s Signed-off-by line to it, and then we can use it directly....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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