Resolves: #1299169 - disable leaf optimization for NFS

This commit is contained in:
Kamil Dudka 2016-06-24 13:24:07 +02:00
parent 9d8af62bd8
commit 662a63d728
2 changed files with 64 additions and 3 deletions

View File

@ -1,7 +1,7 @@
From 1328926a705fdb4728c1f255dd368de928736d39 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Fri, 25 Sep 2015 16:09:39 +0200
Subject: [PATCH 3/4] fts: introduce the FTS_NOLEAF flag
Subject: [PATCH 1/3] fts: introduce the FTS_NOLEAF flag
The flag is needed to implement the -noleaf option of find.
* lib/fts.c (link_count_optimize_ok): Implement the FTS_NOLEAF flag.
@ -57,7 +57,7 @@ index 63d4b74..f1d519b 100644
From c186934e6e37ddadf7511abb9b1045192757618e Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Fri, 25 Sep 2015 19:13:15 +0200
Subject: [PATCH 4/4] ftsfind: propagate the -noleaf option to FTS
Subject: [PATCH 2/3] ftsfind: propagate the -noleaf option to FTS
* find/ftsfind.c (find): Propagate the -noleaf option to FTS.
---
@ -81,3 +81,61 @@ index 5159470..e34b672 100644
--
2.5.0
From 2edb6204bab0acb0ef8cdde7499396afd9c66131 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 18 Jan 2016 17:29:28 +0000
Subject: [PATCH 3/3] fts: don't unconditionally use leaf optimization for NFS
NFS st_nlink are not accurate on all implementations,
leading to aborts() if that assumption is made.
See <https://bugzilla.redhat.com/1299169>
* lib/fts.c (leaf_optimization_applies): Remove NFS from
the white list, and document the issue.
Upstream-commit: 85717b68b03bf85016c5079fbbf0c8aa2b182ba6
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gl/lib/fts.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
index 55cd554..6e1eaf5 100644
--- a/gl/lib/fts.c
+++ b/gl/lib/fts.c
@@ -718,22 +718,23 @@ leaf_optimization_applies (int dir_fd)
switch (fs_buf.f_type)
{
- case S_MAGIC_NFS:
- /* NFS provides usable dirent.d_type but not necessarily for all entries
- of large directories. See <https://bugzilla.redhat.com/1252549>. */
- return true;
-
/* List here the file system types that lack usable dirent.d_type
info, yet for which the optimization does apply. */
case S_MAGIC_REISERFS:
case S_MAGIC_XFS:
return true;
+ /* Explicitly list here any other file system type for which the
+ optimization is not applicable, but need documentation. */
+ case S_MAGIC_NFS:
+ /* NFS provides usable dirent.d_type but not necessarily for all entries
+ of large directories, so as per <https://bugzilla.redhat.com/1252549>
+ NFS should return true. However st_nlink values are not accurate on
+ all implementations as per <https://bugzilla.redhat.com/1299169>. */
+ /* fall through */
case S_MAGIC_PROC:
- /* Explicitly listing this or any other file system type for which
- the optimization is not applicable is not necessary, but we leave
- it here to document the risk. Per http://bugs.debian.org/143111,
- /proc may have bogus stat.st_nlink values. */
+ /* Per <http://bugs.debian.org/143111> /proc may have
+ bogus stat.st_nlink values. */
/* fall through */
default:
return false;
--
2.5.5

View File

@ -1,7 +1,7 @@
Summary: The GNU versions of find utilities (find and xargs)
Name: findutils
Version: 4.6.0
Release: 7%{?dist}
Release: 8%{?dist}
Epoch: 1
License: GPLv3+
Group: Applications/File
@ -132,6 +132,9 @@ fi
%{_infodir}/find-maint.info.gz
%changelog
* Fri Sep 16 2016 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-8
- disable leaf optimization for NFS (#1299169)
* Fri Jun 24 2016 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-7
- bump release to preserve upgrade path f24 -> f25