patch-2.4.7 linux/fs/affs/inode.c

Next file: linux/fs/affs/namei.c
Previous file: linux/fs/affs/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/fs/affs/inode.c linux/fs/affs/inode.c
@@ -120,8 +120,15 @@
 		inode->i_fop = &affs_dir_operations;
 		break;
 	case ST_LINKDIR:
+#if 0
 		affs_warning(sb, "read_inode", "inode is LINKDIR");
 		goto bad_inode;
+#else
+		inode->i_mode |= S_IFDIR;
+		inode->i_op = NULL;
+		inode->i_fop = NULL;
+		break;
+#endif
 	case ST_LINKFILE:
 		affs_warning(sb, "read_inode", "inode is LINKFILE");
 		goto bad_inode;
@@ -207,7 +214,7 @@
 		}
 	}
 	affs_fix_checksum(sb, bh);
-	mark_buffer_dirty(bh);
+	mark_buffer_dirty_inode(bh, inode);
 	affs_brelse(bh);
 	unlock_kernel();
 }
@@ -302,7 +309,7 @@
 	bh = affs_getzeroblk(sb, block);
 	if (!bh)
 		goto err_bh;
-	mark_buffer_dirty(bh);
+	mark_buffer_dirty_inode(bh, inode);
 	affs_brelse(bh);
 
 	inode->i_sb      = sb;
@@ -352,6 +359,7 @@
 	if (!bh)
 		goto done;
 
+	affs_lock_link(inode);
 	switch (type) {
 	case ST_LINKFILE:
 	case ST_LINKDIR:
@@ -377,25 +385,25 @@
 
 	if (inode_bh) {
 		u32 chain;
-		down(&AFFS_INODE->i_link_lock);
 	       	chain = AFFS_TAIL(sb, inode_bh)->link_chain;
 		AFFS_TAIL(sb, bh)->original = cpu_to_be32(inode->i_ino);
 		AFFS_TAIL(sb, bh)->link_chain = chain;
 		AFFS_TAIL(sb, inode_bh)->link_chain = cpu_to_be32(block);
 		affs_adjust_checksum(inode_bh, block - be32_to_cpu(chain));
-		mark_buffer_dirty(inode_bh);
+		mark_buffer_dirty_inode(inode_bh, inode);
 		inode->i_nlink = 2;
 		atomic_inc(&inode->i_count);
-		up(&AFFS_INODE->i_link_lock);
 	}
 	affs_fix_checksum(sb, bh);
-	mark_buffer_dirty(bh);
+	mark_buffer_dirty_inode(bh, inode);
+	dentry->d_fsdata = (void *)bh->b_blocknr;
 
-	down(&AFFS_DIR->i_hash_lock);
+	affs_lock_dir(dir);
 	retval = affs_insert_hash(dir, bh);
-	up(&AFFS_DIR->i_hash_lock);
+	mark_buffer_dirty_inode(bh, inode);
+	affs_unlock_dir(dir);
+	affs_unlock_link(inode);
 
-	dentry->d_fsdata = (void *)bh->b_blocknr;
 	d_instantiate(dentry, inode);
 done:
 	affs_brelse(inode_bh);
@@ -404,5 +412,6 @@
 err:
 	if (block)
 		affs_free_block(sb, block);
+	affs_unlock_link(inode);
 	goto done;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)