- 0 files changed
+ Documentation/filesystems/ext2.txt | 16 ++
+ fs/ext3/Makefile | 2
+ fs/ext3/inode.c | 4
+ fs/ext3/iopen.c | 259 +++++++++++++++++++++++++++++++++++++
+ fs/ext3/iopen.h | 13 +
+ fs/ext3/namei.c | 12 +
+ fs/ext3/super.c | 11 +
+ include/linux/ext3_fs.h | 2
+ 8 files changed, 318 insertions(+), 1 deletion(-)
---- linux-2.4.18-chaos52/Documentation/filesystems/ext2.txt~iopen-2.4.18 2003-04-13 15:21:33.000000000 +0800
-+++ linux-2.4.18-chaos52-root/Documentation/filesystems/ext2.txt 2003-06-03 17:10:55.000000000 +0800
-@@ -35,6 +35,22 @@ resgid=n The group ID which may use th
+Index: linux-aed/Documentation/filesystems/ext2.txt
+===================================================================
+--- linux-aed.orig/Documentation/filesystems/ext2.txt Tue May 4 13:14:35 2004
++++ linux-aed/Documentation/filesystems/ext2.txt Tue May 4 19:17:12 2004
+@@ -35,6 +35,22 @@
sb=n Use alternate superblock at this location.
-+iopen Makes an invisible pseudo-directory called
++iopen Makes an invisible pseudo-directory called
+ __iopen__ available in the root directory
+ of the filesystem. Allows open-by-inode-
+ number. i.e., inode 3145 can be accessed
grpquota,noquota,quota,usrquota Quota options are silently ignored by ext2.
---- linux-2.4.18-chaos52/fs/ext3/Makefile~iopen-2.4.18 2003-06-01 03:24:07.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/Makefile 2003-06-03 17:10:55.000000000 +0800
-@@ -11,7 +11,7 @@ O_TARGET := ext3.o
+Index: linux-aed/fs/ext3/Makefile
+===================================================================
+--- linux-aed.orig/fs/ext3/Makefile Tue May 4 19:16:51 2004
++++ linux-aed/fs/ext3/Makefile Tue May 4 19:17:12 2004
+@@ -11,7 +11,7 @@
- export-objs := super.o inode.o xattr.o
+ export-objs := ext3-exports.o
-obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
- ioctl.o namei.o super.o symlink.o xattr.o
+ ioctl.o namei.o super.o symlink.o xattr.o ext3-exports.o
obj-m := $(O_TARGET)
---- linux-2.4.18-chaos52/fs/ext3/inode.c~iopen-2.4.18 2003-06-03 17:10:21.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/inode.c 2003-06-03 17:10:55.000000000 +0800
+Index: linux-aed/fs/ext3/inode.c
+===================================================================
+--- linux-aed.orig/fs/ext3/inode.c Tue May 4 19:17:09 2004
++++ linux-aed/fs/ext3/inode.c Tue May 4 19:17:12 2004
@@ -31,6 +31,7 @@
#include <linux/highuid.h>
#include <linux/quotaops.h>
/*
* SEARCH_FROM_ZERO forces each block allocation to search from the start
-@@ -2135,6 +2136,9 @@ void ext3_read_inode(struct inode * inod
+@@ -2277,6 +2278,9 @@
struct buffer_head *bh;
int block;
+ if (ext3_iopen_get_inode(inode))
+ return;
-+
++
if(ext3_get_inode_loc(inode, &iloc))
goto bad_inode;
bh = iloc.bh;
---- /dev/null 2002-08-31 07:31:37.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/iopen.c 2003-06-03 17:10:55.000000000 +0800
-@@ -0,0 +1,259 @@
+Index: linux-aed/fs/ext3/iopen.c
+===================================================================
+--- linux-aed.orig/fs/ext3/iopen.c Tue May 4 13:14:35 2004
++++ linux-aed/fs/ext3/iopen.c Tue May 4 19:17:12 2004
+@@ -0,0 +1,282 @@
+/*
+ * linux/fs/ext3/iopen.c
+ *
+ * Special support for open by inode number
+ *
+ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ *
++ *
+ * This file may be redistributed under the terms of the GNU General
+ * Public License.
+ *
+ struct list_head *lp;
+ struct dentry *alternate;
+ char buf[IOPEN_NAME_LEN];
-+
++
+ if (dentry->d_name.len >= IOPEN_NAME_LEN)
+ return ERR_PTR(-ENAMETOOLONG);
+
+ return ERR_PTR(-ENOENT);
+ }
+
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ assert(list_empty(&dentry->d_hash)); /* d_rehash */
++
+ /* preferrably return a connected dentry */
+ spin_lock(&dcache_lock);
+ list_for_each(lp, &inode->i_dentry) {
+ }
+
+ if (!list_empty(&inode->i_dentry)) {
-+ alternate = list_entry(inode->i_dentry.next,
++ alternate = list_entry(inode->i_dentry.next,
+ struct dentry, d_alias);
+ dget_locked(alternate);
+ alternate->d_vfs_flags |= DCACHE_REFERENCED;
+ return alternate;
+ }
+ dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++
++ __d_rehash(dentry, 0); /* d_rehash */
+ spin_unlock(&dcache_lock);
+
-+ d_add(dentry, inode);
+ return NULL;
+}
+
+{
+ const unsigned char *old_name, *new_name;
+
-+ memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
++ memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
+ old_name = target->d_name.name;
+ new_name = dentry->d_name.name;
+ if (old_name == target->d_iname)
+/* This function is spliced into ext3_lookup and does the move of a
+ * disconnected dentry (if it exists) to a connected dentry.
+ */
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
++struct dentry *iopen_connect_dentry(struct dentry *dentry, struct inode *inode,
++ int rehash)
+{
+ struct dentry *tmp, *goal = NULL;
+ struct list_head *lp;
+
-+ /* preferrably return a connected dentry */
-+ spin_lock(&dcache_lock);
+ /* verify this dentry is really new */
-+ assert(!de->d_inode);
-+ assert(list_empty(&de->d_subdirs));
-+ assert(list_empty(&de->d_alias));
++ assert(dentry->d_inode == NULL);
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ if (rehash)
++ assert(list_empty(&dentry->d_hash)); /* d_rehash */
++ assert(list_empty(&dentry->d_subdirs));
+
++ spin_lock(&dcache_lock);
++ if (!inode)
++ goto do_rehash;
+
++ /* preferrably return a connected dentry */
+ list_for_each(lp, &inode->i_dentry) {
+ tmp = list_entry(lp, struct dentry, d_alias);
+ if (tmp->d_flags & DCACHE_NFSD_DISCONNECTED) {
+ }
+ }
+
-+ if (!goal) {
-+ spin_unlock(&dcache_lock);
-+ return NULL;
-+ }
++ if (!goal)
++ goto do_instantiate;
+
+ /* Move the goal to the de hash queue - like d_move() */
+ goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
-+ list_del(&goal->d_hash);
-+ list_add(&goal->d_hash, &de->d_hash);
++ list_del_init(&goal->d_hash);
+
+ list_del(&goal->d_child);
-+ list_del(&de->d_child);
++ list_del(&dentry->d_child);
+
+ /* Switch the parents and the names.. */
-+ switch_names(goal, de);
-+ do_switch(goal->d_parent, de->d_parent);
-+ do_switch(goal->d_name.len, de->d_name.len);
-+ do_switch(goal->d_name.hash, de->d_name.hash);
++ switch_names(goal, dentry);
++ do_switch(goal->d_parent, dentry->d_parent);
++ do_switch(goal->d_name.len, dentry->d_name.len);
++ do_switch(goal->d_name.hash, dentry->d_name.hash);
+
+ /* And add them back to the (new) parent lists */
+ list_add(&goal->d_child, &goal->d_parent->d_subdirs);
-+ list_add(&de->d_child, &de->d_parent->d_subdirs);
++ list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
++ __d_rehash(goal, 0);
+ spin_unlock(&dcache_lock);
++ iput(inode);
+
+ return goal;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++do_instantiate:
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++do_rehash:
++ if (rehash)
++ __d_rehash(dentry, 0); /* d_rehash */
++ spin_unlock(&dcache_lock);
++
++ return NULL;
+}
+
+/*
+
+ inode = iget(dir->i_sb, EXT3_BAD_INO);
+
-+ if (!inode)
++ if (!inode)
+ return 0;
+ d_add(dentry, inode);
+ return 1;
+ inode->u.ext3_i.i_dtime = 0;
+ inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size
+ * (for stat), not the fs block
-+ * size */
++ * size */
+ inode->i_blocks = 0;
+ inode->i_version = 1;
+ inode->i_generation = 0;
+
+ return 1;
+}
---- /dev/null 2002-08-31 07:31:37.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/iopen.h 2003-06-03 17:10:55.000000000 +0800
-@@ -0,0 +1,13 @@
+Index: linux-aed/fs/ext3/iopen.h
+===================================================================
+--- linux-aed.orig/fs/ext3/iopen.h Tue May 4 13:14:35 2004
++++ linux-aed/fs/ext3/iopen.h Tue May 4 19:17:12 2004
+@@ -0,0 +1,15 @@
+/*
+ * iopen.h
+ *
+ * Special support for opening files by inode number.
-+ *
++ *
+ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ *
++ *
+ * This file may be redistributed under the terms of the GNU General
+ * Public License.
+ */
+
+extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
+extern int ext3_iopen_get_inode(struct inode *inode);
---- linux-2.4.18-chaos52/fs/ext3/namei.c~iopen-2.4.18 2003-06-03 17:10:20.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/namei.c 2003-06-03 17:10:55.000000000 +0800
++extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
++ struct inode *inode, int rehash);
+Index: linux-aed/fs/ext3/namei.c
+===================================================================
+--- linux-aed.orig/fs/ext3/namei.c Tue May 4 19:17:05 2004
++++ linux-aed/fs/ext3/namei.c Tue May 4 19:17:12 2004
@@ -34,6 +34,7 @@
#include <linux/locks.h>
#include <linux/quotaops.h>
/*
* define how far ahead to read directories while searching them.
-@@ -703,16 +704,21 @@ cleanup_and_exit:
- brelse (bh_use[ra_ptr]);
- return ret;
- }
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode);
-
- static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry)
- {
- struct inode * inode;
- struct ext3_dir_entry_2 * de;
- struct buffer_head * bh;
-+ struct dentry *alternate = NULL;
-
+@@ -713,6 +714,9 @@
if (dentry->d_name.len > EXT3_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
bh = ext3_find_entry(dentry, &de);
inode = NULL;
if (bh) {
-@@ -723,6 +729,12 @@ static struct dentry *ext3_lookup(struct
+@@ -723,8 +727,8 @@
if (!inode)
return ERR_PTR(-EACCES);
}
+- d_add(dentry, inode);
+- return NULL;
+
-+ if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
-+ iput(inode);
-+ return alternate;
++ return iopen_connect_dentry(dentry, inode, 1);
+ }
+
+ #define S_SHIFT 12
+@@ -1588,10 +1592,6 @@
+ inode->i_nlink);
+ inode->i_version = ++event;
+ inode->i_nlink = 0;
+- /* There's no need to set i_disksize: the fact that i_nlink is
+- * zero will ensure that the right thing happens during any
+- * recovery. */
+- inode->i_size = 0;
+ ext3_orphan_add(handle, inode);
+ ext3_mark_inode_dirty(handle, inode);
+ dir->i_nlink--;
+@@ -1711,6 +1711,23 @@
+ goto out_stop;
+ }
+
++/* Like ext3_add_nondir() except for call to iopen_connect_dentry */
++static int ext3_add_link(handle_t *handle, struct dentry *dentry,
++ struct inode *inode)
++{
++ int err = ext3_add_entry(handle, dentry, inode);
++ if (!err) {
++ err = ext3_mark_inode_dirty(handle, inode);
++ if (err == 0) {
++ (void)iopen_connect_dentry(dentry, inode, 0);
++ return 0;
++ }
+ }
++ ext3_dec_count(handle, inode);
++ iput(inode);
++ return err;
++}
+
- d_add(dentry, inode);
- return NULL;
- }
---- linux-2.4.18-chaos52/fs/ext3/super.c~iopen-2.4.18 2003-06-03 17:10:21.000000000 +0800
-+++ linux-2.4.18-chaos52-root/fs/ext3/super.c 2003-06-03 17:10:55.000000000 +0800
-@@ -820,6 +820,17 @@ static int parse_options (char * options
+ static int ext3_link (struct dentry * old_dentry,
+ struct inode * dir, struct dentry *dentry)
+ {
+@@ -1736,7 +1753,8 @@
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+- err = ext3_add_nondir(handle, dentry, inode);
++ err = ext3_add_link(handle, dentry, inode);
++ ext3_orphan_del(handle, inode);
+ ext3_mark_inode_dirty(handle, inode);
+ ext3_journal_stop(handle, dir);
+ return err;
+Index: linux-aed/fs/ext3/super.c
+===================================================================
+--- linux-aed.orig/fs/ext3/super.c Tue May 4 19:17:01 2004
++++ linux-aed/fs/ext3/super.c Tue May 4 19:17:12 2004
+@@ -834,6 +834,18 @@
|| !strcmp (this_char, "quota")
|| !strcmp (this_char, "usrquota"))
/* Don't do anything ;-) */ ;
+ else if (!strcmp (this_char, "iopen")) {
+ set_opt (sbi->s_mount_opt, IOPEN);
+ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
-+ } else if (!strcmp (this_char, "noiopen")) {
++ }
++ else if (!strcmp (this_char, "noiopen")) {
+ clear_opt (sbi->s_mount_opt, IOPEN);
+ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
+ }
else if (!strcmp (this_char, "journal")) {
/* @@@ FIXME */
/* Eventually we will want to be able to create
---- linux-2.4.18-chaos52/include/linux/ext3_fs.h~iopen-2.4.18 2003-06-03 17:10:22.000000000 +0800
-+++ linux-2.4.18-chaos52-root/include/linux/ext3_fs.h 2003-06-03 17:12:08.000000000 +0800
-@@ -321,6 +321,8 @@ struct ext3_inode {
+Index: linux-aed/include/linux/ext3_fs.h
+===================================================================
+--- linux-aed.orig/include/linux/ext3_fs.h Tue May 4 19:17:08 2004
++++ linux-aed/include/linux/ext3_fs.h Tue May 4 19:17:12 2004
+@@ -321,6 +321,8 @@
#define EXT3_MOUNT_UPDATE_JOURNAL 0x1000 /* Update the journal format */
#define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
#define EXT3_MOUNT_INDEX 0x4000 /* Enable directory index */
+#define EXT3_MOUNT_IOPEN 0x8000 /* Allow access via iopen */
+#define EXT3_MOUNT_IOPEN_NOPRIV 0x10000 /* Make iopen world-readable */
- #define EXT3_MOUNT_ASYNCDEL 0x20000 /* Delayed deletion */
+ #define EXT3_MOUNT_ASYNCDEL 0x20000 /* Delayed deletion */
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
-
-_