changeset 39295:628bbf53398a

fts: treat CIFS like NFS Problem reported by Kamil Dudka in: https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html * lib/fts.c (S_MAGIC_CIFS): New macro. (dirent_inode_sort_may_be_useful, leaf_optimization): Treat CIFS like NFS.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 05 Apr 2018 08:48:01 -0700
parents 1c30fd058b7a
children 9047af4b8210
files ChangeLog lib/fts.c
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 28 22:43:04 2018 +0200
+++ b/ChangeLog	Thu Apr 05 08:48:01 2018 -0700
@@ -1,3 +1,12 @@
+2018-04-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+	fts: treat CIFS like NFS
+	Problem reported by Kamil Dudka in:
+	https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html
+	* lib/fts.c (S_MAGIC_CIFS): New macro.
+	(dirent_inode_sort_may_be_useful, leaf_optimization):
+	Treat CIFS like NFS.
+
 2018-03-28  Bruno Haible  <bruno@clisp.org>
 
 	c-stack: Fix possible build failure on some platforms.
--- a/lib/fts.c	Wed Mar 28 22:43:04 2018 +0200
+++ b/lib/fts.c	Thu Apr 05 08:48:01 2018 -0700
@@ -685,6 +685,7 @@
 
 /* Linux-specific constants from coreutils' src/fs.h */
 # define S_MAGIC_AFS 0x5346414F
+# define S_MAGIC_CIFS 0xFF534D42
 # define S_MAGIC_NFS 0x6969
 # define S_MAGIC_PROC 0x9FA0
 # define S_MAGIC_REISERFS 0x52654973
@@ -792,8 +793,9 @@
 
   switch (filesystem_type (p))
     {
+    case S_MAGIC_CIFS:
+    case S_MAGIC_NFS:
     case S_MAGIC_TMPFS:
-    case S_MAGIC_NFS:
       /* On a file system of any of these types, sorting
          is unnecessary, and hence wasteful.  */
       return false;
@@ -827,6 +829,10 @@
       /* Although AFS mount points are not counted in st_nlink, they
          act like directories.  See <https://bugs.debian.org/143111>.  */
       FALLTHROUGH;
+    case S_MAGIC_CIFS:
+      /* Leaf optimization causes 'find' to abort.  See
+         <https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html>.  */
+      FALLTHROUGH;
     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>