--- linux-2.4.0test5-PRISTINE-RELEASE/MAINTAINERS	Wed Aug  2 18:28:05 2000
+++ linux-2.4.0test5-my/MAINTAINERS	Wed Aug  2 18:47:17 2000
@@ -1142,7 +1142,7 @@
 P:	Matija Nalis
 M:	Matija Nalis <mnalis-umsdos@voyager.hr>
 L:	linux-kernel@vger.rutgers.edu
-W:	http://www.voyager.hr/~mnalis/umsdos/
+W:	http://linux.voyager.hr/umsdos/
 S:	Maintained
 
 UNIFORM CDROM DRIVER
diff -ur linux-2.4.0test5-PRISTINE-RELEASE/include/linux/umsdos_fs.p linux-2.4.0test5-my/include/linux/umsdos_fs.p
--- linux-2.4.0test5-PRISTINE-RELEASE/include/linux/umsdos_fs.p	Wed Aug  2 18:27:38 2000
+++ linux-2.4.0test5-my/include/linux/umsdos_fs.p	Tue Aug  1 17:43:56 2000
@@ -26,6 +26,7 @@
 int umsdos_delentry (struct dentry *, struct umsdos_info *, int);
 int umsdos_findentry (struct dentry *, struct umsdos_info *, int);
 int umsdos_isempty (struct dentry *);
+int umsdos_writeentry (struct dentry *, struct umsdos_info *, int);
 
 /* file.c 25/01/95 02.25.38 */
 
@@ -36,7 +37,7 @@
 int UMSDOS_notify_change (struct dentry *, struct iattr *attr);
 int umsdos_notify_change_locked(struct dentry *, struct iattr *attr);
 void UMSDOS_put_inode (struct inode *);
-int UMSDOS_statfs (struct super_block *, struct statfs *, int);
+int UMSDOS_statfs (struct super_block *, struct statfs *);
 struct super_block *UMSDOS_read_super (struct super_block *, void *, int);
 void UMSDOS_put_super (struct super_block *);
 
diff -ur linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/emd.c linux-2.4.0test5-my/fs/umsdos/emd.c
--- linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/emd.c	Wed Aug  2 18:27:33 2000
+++ linux-2.4.0test5-my/fs/umsdos/emd.c	Wed Aug  2 18:42:28 2000
@@ -22,6 +22,7 @@
 static void copy_entry(struct umsdos_dirent *p, struct umsdos_dirent *q)
 {
 	p->name_len = q->name_len;
+	p->name[p->name_len]='\0';
 	p->flags = q->flags;
 	p->nlink = le16_to_cpu (q->nlink);
 	/* FIXME -- 32bit UID/GID issues */
@@ -119,6 +120,7 @@
 	struct umsdos_dirent *p;
 	int offs = *pos & ~PAGE_CACHE_MASK;
 	int recsize;
+	int ret = 0;
 
 	page = read_cache_page(mapping, *pos>>PAGE_CACHE_SHIFT,
 			(filler_t*)mapping->a_ops->readpage, NULL);
@@ -128,6 +130,15 @@
 	if (!Page_Uptodate(page))
 		goto async_fail;
 	p = (struct umsdos_dirent*)((char*)kmap(page)+offs);
+
+	/* if this is an invalid entry (invalid name length), ignore it */
+	if( p->name_len > UMSDOS_MAXNAME )
+	{
+		printk (KERN_WARNING "Ignoring invalid EMD entry with size %d\n", entry->name_len);
+		p->name_len = 0; 
+		ret = -ENAMETOOLONG; /* notify umssync(8) code that something is wrong */
+	}
+
 	recsize = umsdos_evalrecsize(p->name_len);
 	if (offs + recsize > PAGE_CACHE_SIZE) {
 		struct page *page2;
@@ -157,7 +168,7 @@
 	kunmap(page);
 	page_cache_release(page);
 	*pos += recsize;
-	return 0;
+	return ret;
 async_fail:
 	page_cache_release(page);
 	page = ERR_PTR(-EIO);
@@ -172,7 +183,7 @@
  *
  * Note: the caller must hold a lock on the parent directory.
  */
-static int umsdos_writeentry (struct dentry *parent, struct umsdos_info *info,
+int umsdos_writeentry (struct dentry *parent, struct umsdos_info *info,
 				int free_entry)
 {
 	struct inode *dir = parent->d_inode;
@@ -266,7 +277,7 @@
 			goto out_unlock;
 	} else {
 		ret = mapping->a_ops->prepare_write(NULL,page,offs,
-					info->recsize);
+					offs + info->recsize);
 		if (ret)
 			goto out_unlock;
 		p->name_len = entry->name_len;
@@ -281,7 +292,7 @@
 		p->mode = cpu_to_le16(entry->mode);
 		memcpy(p->spare,entry->spare,((char*)p+info->recsize)-p->spare);
 		ret = mapping->a_ops->commit_write(NULL,page,offs,
-					info->recsize);
+					offs + info->recsize);
 		if (ret)
 			goto out_unlock;
 	}
@@ -373,6 +384,7 @@
 			if (page) {
 				kunmap(page);
 				page_cache_release(page);
+				page = NULL;
 			}
 			if (pos >= emd_dir->i_size) {
 				info->f_pos = empty.posok;
diff -ur linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/inode.c linux-2.4.0test5-my/fs/umsdos/inode.c
--- linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/inode.c	Wed Aug  2 18:27:33 2000
+++ linux-2.4.0test5-my/fs/umsdos/inode.c	Tue Aug  1 19:01:23 2000
@@ -38,8 +38,7 @@
 		 ,atomic_read(&inode->i_count)));
 
 	if (inode == pseudo_root) {
-		printk (KERN_ERR "Umsdos: Oops releasing pseudo_root."
-			" Notify jacques@solucorp.qc.ca\n");
+		printk (KERN_ERR "Umsdos: debug: releasing pseudo_root - ino=%lu count=%d\n", inode->i_ino, atomic_read(&inode->i_count));
 	}
 
 	if (atomic_read(&inode->i_count) == 1)
@@ -203,15 +202,15 @@
 	ret = PTR_ERR(demd);
 	if (IS_ERR(demd))
 		goto out;
-	ret = -EPERM;
-	if (!demd->d_inode) {
-		printk(KERN_WARNING
+	ret = 0;
+	/* don't do anything if directory is not promoted to umsdos yet */
+	if (!demd->d_inode) { 
+		Printk((KERN_DEBUG
 			"UMSDOS_notify_change: no EMD file %s/%s\n",
-			demd->d_parent->d_name.name, demd->d_name.name);
+			demd->d_parent->d_name.name, demd->d_name.name));
 		goto out_dput;
 	}
 
-	ret = 0;
 	/* don't do anything if this is the EMD itself */
 	if (inode == demd->d_inode)
 		goto out_dput;
@@ -295,10 +294,19 @@
 	put_inode:	UMSDOS_put_inode,
 	delete_inode:	fat_delete_inode,
 	put_super:	UMSDOS_put_super,
-	statfs:		fat_statfs,
+	statfs:		UMSDOS_statfs,
 	clear_inode:	fat_clear_inode,
 };
 
+int UMSDOS_statfs(struct super_block *sb,struct statfs *buf)
+{
+	int ret;
+	ret = fat_statfs (sb, buf);
+	if (!ret)	
+		buf->f_namelen = UMSDOS_MAXNAME;
+	return ret;
+}
+
 /*
  * Read the super block of an Extended MS-DOS FS.
  */
@@ -317,7 +325,7 @@
 	if (!res)
 		goto out_fail;
 
-	printk (KERN_INFO "UMSDOS 0.86 "
+	printk (KERN_INFO "UMSDOS 0.86i "
 		"(compatibility level %d.%d, fast msdos)\n", 
 		UMSDOS_VERSION, UMSDOS_RELEASE);
 
diff -ur linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/ioctl.c linux-2.4.0test5-my/fs/umsdos/ioctl.c
--- linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/ioctl.c	Wed Aug  2 18:27:33 2000
+++ linux-2.4.0test5-my/fs/umsdos/ioctl.c	Tue Aug  1 17:39:41 2000
@@ -177,6 +177,16 @@
 			struct umsdos_info info;
 
 			ret = umsdos_emd_dir_readentry (demd, &pos, &entry);
+
+			if (ret == -ENAMETOOLONG) {
+				printk (KERN_INFO "Fixing EMD entry with invalid size -- zeroing out\n");
+				memset (&info, 0, sizeof (info));
+				info.f_pos = f_pos;
+				info.recsize = UMSDOS_REC_SIZE;
+				ret = umsdos_writeentry (dentry, &info, 1);
+				continue;
+			}
+
 			if (ret)
 				break;
 			if (entry.name_len <= 0)
diff -ur linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/namei.c linux-2.4.0test5-my/fs/umsdos/namei.c
--- linux-2.4.0test5-PRISTINE-RELEASE/fs/umsdos/namei.c	Wed Aug  2 18:27:33 2000
+++ linux-2.4.0test5-my/fs/umsdos/namei.c	Wed Jul 26 21:33:49 2000
@@ -335,19 +335,6 @@
 	new_info->entry.nlink = old_info->entry.nlink;
 }
 
-#ifdef OBSOLETE
-#define chkstk() \
-if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page){\
-    printk(KERN_ALERT "UMSDOS: %s magic %x != %lx ligne %d\n" \
-	   , current->comm,STACK_MAGIC \
-	   ,*(unsigned long *)current->kernel_stack_page \
-	   ,__LINE__); \
-}
-
-#undef chkstk
-#define chkstk() do { } while (0);
-#endif
-
 /*
  * Rename a file (move) in the file system.
  */
