diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-15 01:55:58 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-15 01:55:58 +0000 |
commit | 53b3988d474435254a3b053a68bb24ce9e439295 (patch) | |
tree | f8da8e40f01f4ad02bbd76b8c9920749b118235f /fs/umsdos | |
parent | b0cb48abe83d1a4389ea938bf624f8baa82c5047 (diff) |
Merge with 2.3.99-pre9.
Diffstat (limited to 'fs/umsdos')
-rw-r--r-- | fs/umsdos/Makefile | 2 | ||||
-rw-r--r-- | fs/umsdos/check.c | 229 | ||||
-rw-r--r-- | fs/umsdos/dir.c | 6 | ||||
-rw-r--r-- | fs/umsdos/inode.c | 8 | ||||
-rw-r--r-- | fs/umsdos/ioctl.c | 4 | ||||
-rw-r--r-- | fs/umsdos/namei.c | 19 | ||||
-rw-r--r-- | fs/umsdos/rdir.c | 2 |
7 files changed, 24 insertions, 246 deletions
diff --git a/fs/umsdos/Makefile b/fs/umsdos/Makefile index f1b7b3ed4..c14c1b615 100644 --- a/fs/umsdos/Makefile +++ b/fs/umsdos/Makefile @@ -8,7 +8,7 @@ # Note 2: the CFLAGS definitions are now in the main makefile. O_TARGET := umsdos.o -O_OBJS := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o check.o +O_OBJS := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o M_OBJS := $(O_TARGET) diff --git a/fs/umsdos/check.c b/fs/umsdos/check.c deleted file mode 100644 index 58755dd2c..000000000 --- a/fs/umsdos/check.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * linux/fs/umsdos/check.c - * - * Sanity-checking code - */ - -#include <linux/signal.h> -#include <linux/sched.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/types.h> -#include <linux/ptrace.h> -#include <linux/mman.h> -#include <linux/mm.h> -#include <linux/umsdos_fs.h> - -#include <asm/system.h> - -#ifdef CHECK_PAGE_TABLES -static int check_one_table (struct pde *page_dir) -{ - if (pgd_none (*page_dir)) - return 0; - if (pgd_bad (*page_dir)) - return 1; - return 0; -} - -/* - * This function checks all page tables of "current" - */ -void check_page_tables (void) -{ - struct pgd *pg_dir; - static int err = 0; - - int stack_level = (long) (&pg_dir) - current->kernel_stack_page; - - if (stack_level < 1500) - printk ("** %d ** ", stack_level); - pg_dir = PAGE_DIR_OFFSET (current, 0); - if (err == 0) { - int i; - - for (i = 0; i < PTRS_PER_PAGE; i++, page_dir++) { - int notok = check_one_table (page_dir); - - if (notok) { - err++; - printk ("|%d:%08lx| ", i, page_dir->pgd); - } - } - if (err) - printk ("\nError MM %d\n", err); - } -} -#endif - - -#if UMS_DEBUG -/* - * check for wait queue in 2.3.x - */ -inline void uq_log (char *txt, struct inode *inode) -{ - printk (KERN_ERR "%s: (%lu) magic=%lu creator=%lu lock=%u\n", txt, inode->i_ino, inode->u.umsdos_i.dir_info.p.__magic, inode->u.umsdos_i.dir_info.p.__creator, inode->u.umsdos_i.dir_info.p.lock.lock); -} - -/* - * check a superblock - */ - -void check_sb (struct super_block *sb, const char c) -{ - if (sb) { - printk (" (has %c_sb=%d, %d)", - c, MAJOR (sb->s_dev), MINOR (sb->s_dev)); - } else { - printk (" (%c_sb is NULL)", c); - } -} - -/* - * check an inode - */ - -void check_inode (struct inode *inode) -{ - if (inode) { - printk (KERN_DEBUG "* inode is %lu (i_count=%d)", - inode->i_ino, inode->i_count); - check_sb (inode->i_sb, 'i'); - - if (inode->i_dentry.next) { /* FIXME: does this work ? */ - printk (" (has i_dentry)"); - } else { - printk (" (NO i_dentry)"); - } - - printk (" (i_patched=%d)", inode->u.umsdos_i.i_patched); - - } else { - printk (KERN_DEBUG "* inode is NULL\n"); - } -} - -/* - * checks all inode->i_dentry - * - */ -void checkd_inode (struct inode *inode) -{ - struct dentry *ret; - struct list_head *cur; - int count = 0; - if (!inode) { - printk (KERN_ERR "checkd_inode: inode is NULL!\n"); - return; - } - - printk (KERN_DEBUG "checkd_inode: inode %lu\n", inode->i_ino); - cur = inode->i_dentry.next; - while (count++ < 10) { - PRINTK (("1...")); - if (!cur) { - printk (KERN_ERR "checkd_inode: *** NULL reached. exit.\n"); - return; - } - PRINTK (("2...")); - ret = list_entry (cur, struct dentry, d_alias); - PRINTK (("3...")); - if (cur == cur->next) { - printk (KERN_DEBUG "checkd_inode: *** cur=cur->next: normal exit.\n"); - return; - } - PRINTK (("4...")); - if (!ret) { - printk (KERN_ERR "checkd_inode: *** ret dentry is NULL. exit.\n"); - return; - } - PRINTK (("5... (ret=%p)...", ret)); - PRINTK (("5.1.. (ret->d_dname=%p)...", &(ret->d_name))); - PRINTK (("5.1.1. (ret->d_dname.len=%d)...", (int) ret->d_name.len)); - PRINTK (("5.1.2. (ret->d_dname.name=%c)...", ret->d_name.name)); - printk (KERN_DEBUG "checkd_inode: i_dentry is %.*s\n", (int) ret->d_name.len, ret->d_name.name); - PRINTK (("6...")); - cur = cur->next; - PRINTK (("7...")); -#if 1 - printk (KERN_DEBUG "checkd_inode: *** finished after count 1 (operator forced)\n"); - return; -#endif - } - printk (KERN_ERR "checkd_inode: *** OVER LIMIT (loop?) !\n"); - return; -} - -/* - * internal part of check_dentry. does the real job. - * - */ - -void check_dent_int (struct dentry *dentry, int parent) -{ - if (parent) { - printk (KERN_DEBUG "* parent(%d) dentry: %.*s\n", - parent, (int) dentry->d_name.len, dentry->d_name.name); - } else { - printk (KERN_DEBUG "* checking dentry: %.*s\n", - (int) dentry->d_name.len, dentry->d_name.name); - } - check_inode (dentry->d_inode); - printk (KERN_DEBUG "* d_count=%d", dentry->d_count); - check_sb (dentry->d_sb, 'd'); - if (dentry->d_op == NULL) { - printk (" (d_op is NULL)\n"); - } else { - printk (" (d_op is UNKNOWN: %p)\n", dentry->d_op); - } -} - -/* - * checks dentry with full traceback to root and prints info. Limited to 10 recursive depths to avoid infinite loops. - * - */ - -void check_dentry_path (struct dentry *dentry, const char *desc) -{ - int count=0; - printk (KERN_DEBUG "*** check_dentry_path: %.60s\n", desc); - - if (!dentry) { - printk (KERN_DEBUG "*** checking dentry... it is NULL !\n"); - return; - } - if (IS_ERR(dentry)) { - printk (KERN_DEBUG "*** checking dentry... it is ERR(%ld) !\n", - PTR_ERR(dentry)); - return; - } - - while (dentry && count < 10) { - check_dent_int (dentry, count++); - if (IS_ROOT(dentry)) { - printk (KERN_DEBUG "*** end checking dentry (root reached ok)\n"); - break; - } - dentry = dentry->d_parent; - } - - if (count >= 10) { /* if infinite loop detected */ - printk (KERN_ERR - "*** WARNING ! INFINITE LOOP ! check_dentry_path aborted !\n"); - } - - if (!dentry) { - printk (KERN_ERR - "*** WARNING ! NULL dentry ! check_dentry_path aborted !\n"); - } -} -#else -inline void uq_log (char *txt, struct inode *inode) {}; -void check_sb (struct super_block *sb, const char c) {}; -void check_inode (struct inode *inode) {}; -void checkd_inode (struct inode *inode) {}; -void check_dentry_path (struct dentry *dentry, const char *desc) {}; -#endif /* UMS_DEBUG */ - diff --git a/fs/umsdos/dir.c b/fs/umsdos/dir.c index 29eebb3f2..9d37f24bc 100644 --- a/fs/umsdos/dir.c +++ b/fs/umsdos/dir.c @@ -36,12 +36,14 @@ static int umsdos_dentry_validate(struct dentry *dentry, int flags) } /* for now, drop everything to force lookups ... */ -static void umsdos_dentry_dput(struct dentry *dentry) +/* ITYM s/everything/& positive/... */ +static int umsdos_dentry_dput(struct dentry *dentry) { struct inode *inode = dentry->d_inode; if (inode) { - d_drop(dentry); + return 1; } + return 0; } struct dentry_operations umsdos_dentry_operations = diff --git a/fs/umsdos/inode.c b/fs/umsdos/inode.c index 2e172e80b..af69877d9 100644 --- a/fs/umsdos/inode.c +++ b/fs/umsdos/inode.c @@ -367,14 +367,6 @@ struct super_block *UMSDOS_read_super (struct super_block *sb, void *data, sb->s_root = new_root; printk(KERN_INFO "UMSDOS: changed to alternate root\n"); } - - /* if d_count is not 1, mount will fail with -EBUSY! */ - if (sb->s_root->d_count > 1) { - shrink_dcache_sb(sb); - if (sb->s_root->d_count > 1) { - printk(KERN_ERR "UMSDOS: root count %d > 1 !", sb->s_root->d_count); - } - } return sb; out_fail: diff --git a/fs/umsdos/ioctl.c b/fs/umsdos/ioctl.c index 239043318..a8adf6ed8 100644 --- a/fs/umsdos/ioctl.c +++ b/fs/umsdos/ioctl.c @@ -331,6 +331,8 @@ new_dentry->d_parent->d_name.name, new_dentry->d_name.name); ret = -EISDIR; if (!S_ISDIR(temp->d_inode->i_mode)) ret = msdos_unlink (dir, temp); + if (!ret) + d_delete(temp); } dput (temp); goto out; @@ -355,6 +357,8 @@ new_dentry->d_parent->d_name.name, new_dentry->d_name.name); ret = -ENOTDIR; if (S_ISDIR(temp->d_inode->i_mode)) ret = msdos_rmdir (dir, temp); + if (!ret) + d_delete(temp); } dput (temp); goto out; diff --git a/fs/umsdos/namei.c b/fs/umsdos/namei.c index 75715116f..d3fe5eb61 100644 --- a/fs/umsdos/namei.c +++ b/fs/umsdos/namei.c @@ -524,6 +524,7 @@ out_error: out_unlink: printk(KERN_WARNING "umsdos_symlink: write failed, unlinking\n"); UMSDOS_unlink (dir, dentry); + d_drop(dentry); goto out; } @@ -898,9 +899,11 @@ if (err) printk("umsdos_rmdir: EMD %s/%s unlink failed, err=%d\n", demd->d_parent->d_name.name, demd->d_name.name, err); #endif - dput(demd); - if (!err) + if (!err) { + d_delete(demd); ret = 0; + } + dput(demd); } } else if (empty == 2) ret = 0; @@ -921,6 +924,7 @@ demd->d_parent->d_name.name, demd->d_name.name, err); if (ret && ret != -ENOENT) goto out_dput; + d_delete(temp); /* OK so far ... remove the name from the EMD */ ret = umsdos_delentry (dentry->d_parent, &info, 1); #ifdef UMSDOS_PARANOIA @@ -1009,6 +1013,8 @@ Printk (("UMSDOS_unlink %.*s ", info.fake.len, info.fake.fname)); } ret = msdos_unlink(dir, temp); + if (!ret) + d_delete(temp); #ifdef UMSDOS_PARANOIA if (ret) printk("umsdos_unlink: %s/%s unlink failed, ret=%d\n", @@ -1018,8 +1024,6 @@ temp->d_parent->d_name.name, temp->d_name.name, ret); /* dput() temp if we didn't do it above */ out_dput: dput(temp); - if (!ret) - d_delete (dentry); out_unlock: umsdos_unlockcreate (dir); @@ -1065,7 +1069,8 @@ link->d_parent->d_name.name, link->d_name.name, ret)); printk(KERN_WARNING "umsdos_unlink: link removal failed, ret=%d\n", ret); - } + } else + d_delete(link); } else { struct iattr newattrs; inode->i_nlink--; @@ -1100,11 +1105,13 @@ int UMSDOS_rename (struct inode *old_dir, struct dentry *old_dentry, * If the target already exists, delete it first. */ if (new_dentry->d_inode) { - new_dentry->d_count++; + dget(new_dentry); if (S_ISDIR(old_dentry->d_inode->i_mode)) ret = UMSDOS_rmdir (new_dir, new_dentry); else ret = UMSDOS_unlink (new_dir, new_dentry); + if (!ret) + d_drop(new_dentry); dput(new_dentry); if (ret) return ret; diff --git a/fs/umsdos/rdir.c b/fs/umsdos/rdir.c index 8c71dd727..a477ade2c 100644 --- a/fs/umsdos/rdir.c +++ b/fs/umsdos/rdir.c @@ -174,6 +174,8 @@ static int UMSDOS_rrmdir ( struct inode *dir, struct dentry *dentry) ret = 0; if (demd->d_inode) ret = msdos_unlink (dentry->d_inode, demd); + if (!ret) + d_delete(demd); dput(demd); } } |