diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3bfd501 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/xfsdump-3.1.8.tar.xz diff --git a/.xfsdump.metadata b/.xfsdump.metadata new file mode 100644 index 0000000..610e0fa --- /dev/null +++ b/.xfsdump.metadata @@ -0,0 +1 @@ +34fd97ecd92ced92e9c51c8c0ff37dabf627aefb SOURCES/xfsdump-3.1.8.tar.xz diff --git a/SOURCES/0001-xfsdump-Revert-xfsdump-handle-bind-mount-targets.patch b/SOURCES/0001-xfsdump-Revert-xfsdump-handle-bind-mount-targets.patch new file mode 100644 index 0000000..2a2656f --- /dev/null +++ b/SOURCES/0001-xfsdump-Revert-xfsdump-handle-bind-mount-targets.patch @@ -0,0 +1,66 @@ +From 3b71c7f1f5a1dd45712d7de1139290d0a8cf03c4 Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Thu, 3 Feb 2022 12:42:30 -0500 +Subject: [PATCH 1/2] xfsdump: Revert "xfsdump: handle bind mount targets" + +Bind mount mntpnts will be forbided in the next commits +instead since it's not the real rootdir. + +This cannot be reverted cleanly due to several cleanup +patches, but the logic is reverted equivalently. + +This reverts commit 25195ebf107dc81b1b7cea1476764950e1d6cc9d. + +Fixes: 25195ebf107d ("xfsdump: handle bind mount targets") +Cc: Eric Sandeen +Signed-off-by: Gao Xiang +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + +Index: xfsdump-3.1.8/dump/content.c +=================================================================== +--- xfsdump-3.1.8.orig/dump/content.c ++++ xfsdump-3.1.8/dump/content.c +@@ -1382,17 +1382,11 @@ baseuuidbypass: + } + + /* figure out the ino for the root directory of the fs +- * and get its xfs_bstat_t for inomap_build(). This could +- * be a bind mount; don't ask for the mount point inode, +- * find the actual lowest inode number in the filesystem. ++ * and get its xfs_bstat_t for inomap_build() + */ + { + stat64_t rootstat; +- xfs_ino_t lastino = 0; +- int ocount = 0; +- xfs_fsop_bulkreq_t bulkreq; + +- /* Get the inode of the mount point */ + rval = fstat64( sc_fsfd, &rootstat ); + if ( rval ) { + mlog( MLOG_NORMAL, _( +@@ -1404,21 +1398,11 @@ baseuuidbypass: + ( xfs_bstat_t * )calloc( 1, sizeof( xfs_bstat_t )); + assert( sc_rootxfsstatp ); + +- /* Get the first valid (i.e. root) inode in this fs */ +- bulkreq.lastip = (__u64 *)&lastino; +- bulkreq.icount = 1; +- bulkreq.ubuffer = sc_rootxfsstatp; +- bulkreq.ocount = &ocount; +- if (ioctl(sc_fsfd, XFS_IOC_FSBULKSTAT, &bulkreq) < 0) { ++ if (bigstat_one(sc_fsfd, rootstat.st_ino, sc_rootxfsstatp) < 0) { + mlog( MLOG_ERROR, + _("failed to get bulkstat information for root inode\n")); + return BOOL_FALSE; + } +- +- if (sc_rootxfsstatp->bs_ino != rootstat.st_ino) +- mlog ( MLOG_NORMAL | MLOG_NOTE, +- _("root ino %lld differs from mount dir ino %lld, bind mount?\n"), +- sc_rootxfsstatp->bs_ino, rootstat.st_ino); + } + + /* alloc a file system handle, to be used with the jdm_open() diff --git a/SOURCES/0002-xfsdump-intercept-bind-mount-targets.patch b/SOURCES/0002-xfsdump-intercept-bind-mount-targets.patch new file mode 100644 index 0000000..90eb495 --- /dev/null +++ b/SOURCES/0002-xfsdump-intercept-bind-mount-targets.patch @@ -0,0 +1,100 @@ +From 0717c1cdfeaedc98df8af97b5ab110830e176a5b Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Thu, 3 Feb 2022 12:42:30 -0500 +Subject: [PATCH 2/2] xfsdump: intercept bind mount targets + +It's a bit strange pointing at some non-root bind mount target and +then actually dumping from the actual root dir instead. + +Therefore, instead of searching for the root dir of the filesystem, +just intercept all bind mount targets by checking whose ino # of +".." is itself with getdents. + +Fixes: 25195ebf107d ("xfsdump: handle bind mount targets") +Cc: Eric Sandeen +Signed-off-by: Gao Xiang +[sandeen: add explanatory comment to new function] +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + +Index: xfsdump-3.1.8/dump/content.c +=================================================================== +--- xfsdump-3.1.8.orig/dump/content.c ++++ xfsdump-3.1.8/dump/content.c +@@ -511,6 +511,60 @@ static bool_t create_inv_session( + ix_t subtreecnt, + size_t strmix); + ++/* ++ * Verify that we are asked to dump from the root of the filesystem; ++ * test this by checking whether the inode number we've been given matches ++ * the inode number for this directory's ".." ++ */ ++static bool_t ++check_rootdir(int fd, ++ xfs_ino_t ino) ++{ ++ struct dirent *gdp; ++ size_t gdsz; ++ bool_t found = BOOL_FALSE; ++ ++ gdsz = sizeof(struct dirent) + NAME_MAX + 1; ++ if (gdsz < GETDENTSBUF_SZ_MIN) ++ gdsz = GETDENTSBUF_SZ_MIN; ++ gdp = (struct dirent *)calloc(1, gdsz); ++ assert(gdp); ++ ++ while (1) { ++ struct dirent *p; ++ int nread; ++ ++ nread = getdents_wrap(fd, (char *)gdp, gdsz); ++ /* ++ * negative count indicates something very bad happened; ++ * try to gracefully end this dir. ++ */ ++ if (nread < 0) { ++ mlog(MLOG_NORMAL | MLOG_WARNING, ++_("unable to read dirents for directory ino %llu: %s\n"), ++ ino, strerror(errno)); ++ break; ++ } ++ ++ /* no more directory entries: break; */ ++ if (!nread) ++ break; ++ ++ for (p = gdp; nread > 0; ++ nread -= (int)p->d_reclen, ++ assert(nread >= 0), ++ p = (struct dirent *)((char *)p + p->d_reclen)) { ++ if (!strcmp(p->d_name, "..")) { ++ if (p->d_ino == ino) ++ found = BOOL_TRUE; ++ break; ++ } ++ } ++ } ++ free(gdp); ++ return found; ++} ++ + bool_t + content_init( int argc, + char *argv[ ], +@@ -1394,6 +1448,14 @@ baseuuidbypass: + mntpnt ); + return BOOL_FALSE; + } ++ ++ if (!check_rootdir(sc_fsfd, rootstat.st_ino)) { ++ mlog(MLOG_ERROR, ++_("%s is not the root of the filesystem (bind mount?) - use primary mountpoint\n"), ++ mntpnt); ++ return BOOL_FALSE; ++ } ++ + sc_rootxfsstatp = + ( xfs_bstat_t * )calloc( 1, sizeof( xfs_bstat_t )); + assert( sc_rootxfsstatp ); diff --git a/SPECS/xfsdump.spec b/SPECS/xfsdump.spec new file mode 100644 index 0000000..0d2287b --- /dev/null +++ b/SPECS/xfsdump.spec @@ -0,0 +1,215 @@ +Summary: Administrative utilities for the XFS filesystem +Name: xfsdump +Version: 3.1.8 +Release: 4%{?dist} +# Licensing based on generic "GNU GENERAL PUBLIC LICENSE" +# in source, with no mention of version. +License: GPL+ +Group: System Environment/Base +URL: http://oss.sgi.com/projects/xfs/ +Source0: http://kernel.org/pub/linux/utils/fs/xfs/%{name}/%{name}-%{version}.tar.xz +Patch0: 0001-xfsdump-Revert-xfsdump-handle-bind-mount-targets.patch +Patch1: 0002-xfsdump-intercept-bind-mount-targets.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: libtool, gettext, gawk +BuildRequires: xfsprogs-devel, libuuid-devel, libattr-devel ncurses-devel +Requires: xfsprogs >= 2.6.30, attr >= 2.0.0 + +%description +The xfsdump package contains xfsdump, xfsrestore and a number of +other utilities for administering XFS filesystems. + +xfsdump examines files in a filesystem, determines which need to be +backed up, and copies those files to a specified disk, tape or other +storage medium. It uses XFS-specific directives for optimizing the +dump of an XFS filesystem, and also knows how to backup XFS extended +attributes. Backups created with xfsdump are "endian safe" and can +thus be transfered between Linux machines of different architectures +and also between IRIX machines. + +xfsrestore performs the inverse function of xfsdump; it can restore a +full backup of a filesystem. Subsequent incremental backups can then +be layered on top of the full backup. Single files and directory +subtrees may be restored from full or partial backups. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +%configure + +make V=1 %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make DIST_ROOT=$RPM_BUILD_ROOT install +# remove non-versioned docs location +rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/xfsdump/ + +# Bit of a hack to move files from /sbin to /usr/sbin +(cd $RPM_BUILD_ROOT/%{_sbindir}; rm xfsdump xfsrestore) +(cd $RPM_BUILD_ROOT/%{_sbindir}; mv ../../sbin/xfsdump .) +(cd $RPM_BUILD_ROOT/%{_sbindir}; mv ../../sbin/xfsrestore .) + +# Create inventory dir (otherwise created @ runtime) +mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/xfsdump/inventory + +%find_lang %{name} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files -f %{name}.lang +%defattr(-,root,root) +%doc README doc/COPYING doc/CHANGES doc/README.xfsdump doc/xfsdump_ts.txt +%{_mandir}/man8/* +%{_sbindir}/* +%{_sharedstatedir}/xfsdump/inventory + +%changelog +* Fri Feb 11 2022 Eric Sandeen 3.1.8-4 +- Fix bind mount vs root inode problems (#2020494) + +* Wed May 15 2019 Eric Sandeen 3.1.8-3 +- Bump revision for test infrastructure (#1681970) + +* Fri Feb 09 2018 Fedora Release Engineering - 3.1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Sep 21 2017 Eric Sandeen 3.1.8-1 +- New upstream release + +* Thu Aug 03 2017 Fedora Release Engineering - 3.1.6-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 3.1.6-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Jun 08 2017 Eric Sandeen 3.1.6-4 +- Build with largefile support on 32-bit platforms + +* Sat Feb 11 2017 Fedora Release Engineering - 3.1.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Feb 05 2016 Fedora Release Engineering - 3.1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Eric Sandeen 3.1.6-1 +- New upstream release + +* Fri Jun 19 2015 Fedora Release Engineering - 3.1.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Aug 18 2014 Fedora Release Engineering - 3.1.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Thu Jul 17 2014 Eric Sandeen 3.1.4-1 +- New upstream release + +* Mon Jun 16 2014 Eric Sandeen 3.1.3-5 +- Fix aarch64 build (#926800) + +* Sun Jun 08 2014 Fedora Release Engineering - 3.1.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon Jan 20 2014 Eric Sandeen 3.1.3-3 +- Add /var/lib/xfsdump/inventory to file list (was created runtime) + +* Sun Aug 04 2013 Fedora Release Engineering - 3.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed May 08 2013 Eric Sandeen 3.1.3-1 +- New upstream release + +* Fri Feb 15 2013 Fedora Release Engineering - 3.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Dec 13 2012 Eric Sandeen 3.1.2-1 +- New upstream release, with non-broken tarball + +* Thu Dec 13 2012 Eric Sandeen 3.1.1-1 +- New upstream release + +* Sun Jul 22 2012 Fedora Release Engineering - 3.1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Mar 28 2012 Eric Sandeen 3.1.0-2 +- Move files out of /sbin to /usr/sbin + +* Fri Mar 23 2012 Eric Sandeen 3.1.0-1 +- New upstream release + +* Sat Jan 14 2012 Fedora Release Engineering - 3.0.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Oct 17 2011 Eric Sandeen 3.0.6-1 +- New upstream release + +* Thu Mar 31 2011 Eric Sandeen 3.0.5-1 +- New upstream release + +* Mon Feb 07 2011 Fedora Release Engineering - 3.0.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jan 13 2010 Eric Sandeen 3.0.4-1 +- New upstream release + +* Mon Nov 30 2009 Dennis Gregorovic - 3.0.1-3.1 +- Rebuilt for RHEL 6 + +* Mon Jul 27 2009 Fedora Release Engineering - 3.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Jun 30 2009 Eric Sandeen 3.0.1-2 +- Fix up build-requires after e2fsprogs splitup + +* Tue May 05 2009 Eric Sandeen 3.0.1-1 +- New upstream release + +* Thu Feb 26 2009 Fedora Release Engineering - 3.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 04 2009 Eric Sandeen 3.0.0-1 +- New upstream release + +* Wed Nov 12 2008 Eric Sandeen 2.2.48-2 +- Enable parallel builds + +* Sun Feb 10 2008 Eric Sandeen - 2.2.48-1 +- Update to xfsdump version 2.2.48 +- First build with gcc-4.3 + +* Mon Sep 10 2007 Eric Sandeen - 2.2.46-1 +- Update to xfsdump version 2.2.46 +- Dropped O_CREAT patch, now upstream + +* Fri Aug 24 2007 Eric Sandeen - 2.2.45-3 +- Update license tag +- Fix up O_CREAT opens with no mode +- Add gawk to buildrequires + +* Tue Jun 19 2007 Eric Sandeen - 2.2.45-2 +- Remove readline-devel & libtermcap-devel BuildRequires + +* Thu May 31 2007 Eric Sandeen - 2.2.45-1 +- Update to xfsdump 2.2.45 + +* Thu Aug 31 2006 Russell Cattelan - 2.2.42-2 +- Remove Distribution: tag + +* Wed Aug 23 2006 Russell Cattelan - 2.2.42-1 +- update to version 2.2.42 + +* Tue Aug 22 2006 Russell Cattelan - 2.2.38-3 +- Fix the /usr/sbin sym links to relative links +- Add the Distribution tag +- Add ncurses-devel to buildrequires + +* Wed Aug 16 2006 Russell Cattelan - 2.2.38-2 +- install removes the makefile installed version of the docs + package the docs based in the version specfic directory + +* Wed Aug 9 2006 Russell Cattelan - 2.2.38-1 +- Add xfsdump to Fedora