Hi Jim,

On Sat October 31 2009 12:22:01 Jim Meyering wrote:
> I'm trying to reconcile this file system's behavior with
> fundamental assumptions about unchanging device/inode,
> and as a result am having second thoughts.
> 
> What event causes the directory's stat.st_dev to change?
> Opening the directory?  Calling readdir?  Accessing one
> of its entries?
> 
> Can you describe how to reproduce the problem on rawhide or Fedora 12?

all the info should be already placed at the RH bug (where you are also
subscribed):

https://bugzilla.redhat.com/501848

Let me know if there is anything missing. A new version of the patch is 
attached. Any feedback welcome!

Kamil
From 69fd52bd5c7c4f71629a9a756548bc02ef8905db Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdu...@redhat.com>
Date: Tue, 3 Nov 2009 14:14:53 +0100
Subject: [PATCH] fts: do not fail on a submount during traversal

* lib/fts.c (fts_build): Read the stat info again after opening
a directory.
Original report at http://bugzilla.redhat.com/501848.
---
 ChangeLog |    7 +++++++
 lib/fts.c |   11 +++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 239ec70..406749c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-03  Kamil Dudka  <kdu...@redhat.com>
+
+	fts: do not fail on a submount during traversal
+	* lib/fts.c (fts_build): Read the stat info again after opening
+	a directory.
+	Original report at http://bugzilla.redhat.com/501848.
+
 2009-11-03  Jim Meyering  <meyer...@redhat.com>
 
 	test-getaddrinfo: avoid compilation failure on FreeBSD 7.2
diff --git a/lib/fts.c b/lib/fts.c
index 40a837e..d0715cf 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1268,6 +1268,17 @@ fts_build (register FTS *sp, int type)
 	  opening it.  */
        if (cur->fts_info == FTS_NSOK)
 	 cur->fts_info = fts_stat(sp, cur, false);
+       else {
+	 /* Now read the stat info again after opening a directory to reveal
+	  * eventual changes caused by a submount triggered by the traverse.  */
+	 LEAVE_DIR (sp, cur, "4");
+	 fts_stat (sp, cur, false);
+         if (! enter_dir (sp, cur))
+           {
+             __set_errno (ENOMEM);
+             return NULL;
+           }
+       }
 
 	/*
 	 * Nlinks is the number of possible entries of type directory in the
-- 
1.6.2.5

Reply via email to