From: Dave Chinner <dchinner@xxxxxxxxxx>
When Christoph and I were discussing bulkstat coherency on IRC, we
realised that inode lookup from bulkstat was not actually looking up
the inode allocation btree in xfs_imap() before reading the inode
buffer from disk in xfs_iread(). Bulkstat uses the same lookup
mechanism as handle validation to avoid shutting down the filesystem
if inode numbers that point to non-inode buffers (i.e. invalid) are
passed in the handle.
The problem with this is that when we delete inodes from disk and we
remove the inode chunk (i.e. deallocate inodes) we mark both the
inodes in memory and the cluster buffer as stale, thereby preventing
it from being written back to disk. The result of this is that some
number of inodes remain on disk looking like allocated, in use
inodes (i.e. di_mode is not zero).
Hence if we get a cold cache lookup from a stale handle that
references such an inode, we can read the inode off disk even though
it has been deleted because we don't check if the inode is allocated
or not. If the inode chunk has not been overwritten, then the inode
read will succeed and the handle-to-dentry conversion will not error
out like it is supposed to. The result is that stale NFS filehandles
and open_by_handle() will succeed incorrectly on unlinked files for
cold cache lookups.
This is a bug that has been present ever since the inode chunk
deletion code was implemented. This test exercises the problem and
documents the hoops you have to jump through to reproduce it.
o suppress mkfs output that was unnoticed due to failure noise
o fix exit value so test reports success correctly (e.g. when run
with MOUNT_OPTIONS="-o ikeep")
Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
238 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
238.out | 2 ++
group | 1 +
src/Makefile | 3 ++-
4 files changed, 62 insertions(+), 1 deletions(-)
create mode 100755 238
create mode 100644 238.out
diff --git a/238 b/238
new file mode 100755
@@ -0,0 +1,57 @@
+# FS QA Test No. $id
+# what am I here for?
+# Copyright (c) 2010 Red Hat, Inc. All Rights Reserved.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+echo "QA output created by $seq"
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+ cd /
+ rm -f $tmp.*
+# get standard environment, filters and checks
+# real QA test starts here
+# Modify as appropriate.
+echo "Silence is golden"
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount > /dev/null 2>&1
diff --git a/238.out b/238.out
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 238
+Silence is golden
diff --git a/group b/group
index 5c2d252..ee835d6 100644
@@ -351,3 +351,4 @@ deprecated
235 auto quota quick
236 auto quick metadata
237 auto quick acl
+238 auto quick metadata ioctl
diff --git a/src/Makefile b/src/Makefile
index 976133d..e878cff 100644
@@ -15,7 +15,8 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
locktest unwritten_mmap bulkstat_unlink_test t_stripealign \
- bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable
+ bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \