patch for pre-123-3 msdos-fs

Bill Hawes (whawes@transmeta.com)
Sun, 27 Sep 1998 12:18:42 -0700


This is a multi-part message in MIME format.
--------------6E6D3385C20BD285C07EDF08
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch for msdos-fs fixes a bug when switching inodes for a
cross-directory move. The i_nlink field must be copied to the new inode
to avoid corruption when moving a directory.

Regards,
Bill

--------------6E6D3385C20BD285C07EDF08
Content-Type: text/plain; charset=us-ascii; name="msdos_123-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="msdos_123-patch"

--- linux-2.1.123/fs/msdos/namei.c Sun Sep 27 11:44:04 1998
+++ linux-2.1.122/fs/msdos/namei.c Wed Sep 23 11:51:21 1998
@@ -806,8 +806,13 @@
if (S_ISDIR(old_inode->i_mode)) {
error = fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
&dotdot_de, &dotdot_ino, SCAN_ANY);
- if (error < 0)
+ if (error < 0) {
+ printk(KERN_WARNING
+ "MSDOS: %s/%s, get dotdot failed, ret=%d\n",
+ old_dentry->d_parent->d_name.name,
+ old_dentry->d_name.name, error);
goto rename_done;
+ }
error = -EIO;
dotdot_inode = iget(sb, dotdot_ino);
if (!dotdot_inode)
@@ -832,7 +837,6 @@
if (!list_empty(&free_inode->i_dentry))
printk("msdos_rename_diff: free inode has aliases??\n");
msdos_read_inode(free_inode);
- fat_mark_buffer_dirty(sb, free_bh, 1);

/*
* Make sure the old dentry isn't busy,
@@ -854,6 +858,7 @@
d_delete(old_dentry);

free_inode->i_mode = old_inode->i_mode;
+ free_inode->i_nlink = old_inode->i_nlink;
free_inode->i_size = old_inode->i_size;
free_inode->i_blocks = old_inode->i_blocks;
free_inode->i_mtime = old_inode->i_mtime;
@@ -875,6 +880,7 @@
*/
d_instantiate(old_dentry, free_inode);

+ fat_mark_buffer_dirty(sb, free_bh, 1);
fat_cache_inval_inode(old_inode);
mark_inode_dirty(old_inode);
old_de->name[0] = DELETED_FLAG;

--------------6E6D3385C20BD285C07EDF08--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/