head	1.1;
access;
symbols
	LKML-branch:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2006.10.24.06.14.17;	author jsipek;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2006.10.24.06.14.17;	author jsipek;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2006.11.07.06.13.33;	author jsipek;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2006.12.11.14.23.59;	author jsipek;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2006.12.31.22.29.19;	author jsipek;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2007.01.21.23.59.13;	author jsipek;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2007.01.25.08.38.30;	author jsipek;	state dead;
branches;
next	1.1.2.7;

1.1.2.7
date	2007.01.28.22.24.33;	author jsipek;	state Exp;
branches;
next	;


desc
@@


1.1
log
@file staleinode was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@Move unionfs specific bits into a subdir
@
text
@a0 128
Unionfs: Handling of stale inodes

From: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>

Provides nicer handling of stale inodes.

Signed-off-by: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>
Signed-off-by: David Quigley <dquigley@@fsl.cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@@cs.sunysb.edu>

diff -r 755813d6d5d8 fs/unionfs/stale_inode.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fs/unionfs/stale_inode.c	Wed Oct 04 20:32:15 2006 -0400
@@@@ -0,0 +1,114 @@@@
+/*
+ *  Adpated from linux/fs/bad_inode.c
+ *
+ *  Copyright (C) 1997, Stephen Tweedie
+ *
+ *  Provide stub functions for "stale" inodes, a bit friendlier than the
+ *  -EIO that bad_inode.c does.
+ */
+
+#include <linux/version.h>
+
+#include <linux/fs.h>
+#include <linux/stat.h>
+#include <linux/sched.h>
+
+static struct address_space_operations unionfs_stale_aops;
+
+/* declarations for "sparse */
+extern struct inode_operations stale_inode_ops;
+
+/*
+ * The follow_link operation is special: it must behave as a no-op
+ * so that a stale root inode can at least be unmounted. To do this
+ * we must dput() the base and return the dentry with a dget().
+ */
+static void *stale_follow_link(struct dentry *dent, struct nameidata *nd)
+{
+	return ERR_PTR(vfs_follow_link(nd, ERR_PTR(-ESTALE)));
+}
+
+static int return_ESTALE(void)
+{
+	return -ESTALE;
+}
+
+#define ESTALE_ERROR ((void *) (return_ESTALE))
+
+static struct file_operations stale_file_ops = {
+	.llseek = ESTALE_ERROR,
+	.read = ESTALE_ERROR,
+	.write = ESTALE_ERROR,
+	.readdir = ESTALE_ERROR,
+	.poll = ESTALE_ERROR,
+	.ioctl = ESTALE_ERROR,
+	.mmap = ESTALE_ERROR,
+	.open = ESTALE_ERROR,
+	.flush = ESTALE_ERROR,
+	.release = ESTALE_ERROR,
+	.fsync = ESTALE_ERROR,
+	.fasync = ESTALE_ERROR,
+	.lock = ESTALE_ERROR,
+};
+
+struct inode_operations stale_inode_ops = {
+	.create = ESTALE_ERROR,
+	.lookup = ESTALE_ERROR,
+	.link = ESTALE_ERROR,
+	.unlink = ESTALE_ERROR,
+	.symlink = ESTALE_ERROR,
+	.mkdir = ESTALE_ERROR,
+	.rmdir = ESTALE_ERROR,
+	.mknod = ESTALE_ERROR,
+	.rename = ESTALE_ERROR,
+	.readlink = ESTALE_ERROR,
+	.follow_link = stale_follow_link,
+	.truncate = ESTALE_ERROR,
+	.permission = ESTALE_ERROR,
+};
+
+/*
+ * When a filesystem is unable to read an inode due to an I/O error in
+ * its read_inode() function, it can call make_stale_inode() to return a
+ * set of stubs which will return ESTALE errors as required.
+ *
+ * We only need to do limited initialisation: all other fields are
+ * preinitialised to zero automatically.
+ */
+
+/**
+ *	make_stale_inode - mark an inode stale due to an I/O error
+ *	@@inode: Inode to mark stale
+ *
+ *	When an inode cannot be read due to a media or remote network
+ *	failure this function makes the inode "stale" and causes I/O operations
+ *	on it to fail from this point on.
+ */
+
+void make_stale_inode(struct inode *inode)
+{
+	inode->i_mode = S_IFREG;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_op = &stale_inode_ops;
+	inode->i_fop = &stale_file_ops;
+	inode->i_mapping->a_ops = &unionfs_stale_aops;
+}
+
+/*
+ * This tests whether an inode has been flagged as stale. The test uses
+ * &stale_inode_ops to cover the case of invalidated inodes as well as
+ * those created by make_stale_inode() above.
+ */
+
+/**
+ *	is_stale_inode - is an inode errored
+ *	@@inode: inode to test
+ *
+ *	Returns true if the inode in question has been marked as stale.
+ */
+
+int is_stale_inode(struct inode *inode)
+{
+	return (inode->i_op == &stale_inode_ops);
+}
+
@


1.1.2.2
log
@Git generates slightly different diffs - same information, just little
different
@
text
@d11 3
a13 5
diff --git a/fs/unionfs/stale_inode.c b/fs/unionfs/stale_inode.c
new file mode 100644
index 0000000..4255dfd
--- /dev/null
+++ b/fs/unionfs/stale_inode.c
@


1.1.2.3
log
@Folded unionfs-lkml-comments-jan
@
text
@d14 3
a16 5

diff -r d4c922f43f4e fs/unionfs/stale_inode.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fs/unionfs/stale_inode.c	Mon Dec 11 09:07:38 2006 -0500
@@@@ -0,0 +1,112 @@@@
d55 13
a67 13
+	.llseek		= ESTALE_ERROR,
+	.read		= ESTALE_ERROR,
+	.write		= ESTALE_ERROR,
+	.readdir	= ESTALE_ERROR,
+	.poll		= ESTALE_ERROR,
+	.ioctl		= ESTALE_ERROR,
+	.mmap		= ESTALE_ERROR,
+	.open		= ESTALE_ERROR,
+	.flush		= ESTALE_ERROR,
+	.release	= ESTALE_ERROR,
+	.fsync		= ESTALE_ERROR,
+	.fasync		= ESTALE_ERROR,
+	.lock		= ESTALE_ERROR,
d71 13
a83 13
+	.create		= ESTALE_ERROR,
+	.lookup		= ESTALE_ERROR,
+	.link		= ESTALE_ERROR,
+	.unlink		= ESTALE_ERROR,
+	.symlink	= ESTALE_ERROR,
+	.mkdir		= ESTALE_ERROR,
+	.rmdir		= ESTALE_ERROR,
+	.mknod		= ESTALE_ERROR,
+	.rename		= ESTALE_ERROR,
+	.readlink	= ESTALE_ERROR,
+	.follow_link	= stale_follow_link,
+	.truncate	= ESTALE_ERROR,
+	.permission	= ESTALE_ERROR,
d96 2
a97 2
+ * make_stale_inode - mark an inode stale due to an I/O error
+ * @@inode: Inode to mark stale
d99 3
a101 3
+ * When an inode cannot be read due to a media or remote network
+ * failure this function makes the inode "stale" and causes I/O operations
+ * on it to fail from this point on.
d103 1
d120 2
a121 2
+ * is_stale_inode - is an inode errored
+ * @@inode: inode to test
d123 1
a123 1
+ * Returns true if the inode in question has been marked as stale.
d125 1
@


1.1.2.4
log
@Small cleanup
@
text
@d11 4
@


1.1.2.5
log
@A. Bunk's patch, more akpm comments, new copyright
@
text
@d11 3
a13 5
diff --git a/fs/unionfs/stale_inode.c b/fs/unionfs/stale_inode.c
new file mode 100644
index 0000000..bce938d
--- /dev/null
+++ b/fs/unionfs/stale_inode.c
@


1.1.2.6
log
@Removed stale_inode.c & associated patches

stale_inode.c seemed to be completely superfluous, and needed to be synced
up with current version of bad_inode.c or dropped. Dropping is considerably
cleaner.
@
text
@@


1.1.2.7
log
@Remove stale_inode.c the proper way - separate patch
@
text
@@


