patch-2.1.132 linux/fs/autofs/root.c

Next file: linux/fs/buffer.c
Previous file: linux/fs/autofs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.131/linux/fs/autofs/root.c linux/fs/autofs/root.c
@@ -223,7 +223,8 @@
 	sbi = (struct autofs_sb_info *) dir->i_sb->u.generic_sbp;
 
 	oz_mode = autofs_oz_mode(sbi);
-	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n", current->pid, current->pgrp, sbi->catatonic, oz_mode));
+	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
+		 current->pid, current->pgrp, sbi->catatonic, oz_mode));
 
 	/*
 	 * Mark the dentry incomplete, but add it. This is needed so
@@ -395,6 +396,7 @@
 	struct autofs_sb_info *sbi = (struct autofs_sb_info *) dir->i_sb->u.generic_sbp;
 	struct autofs_dirhash *dh = &sbi->dirhash;
 	struct autofs_dir_ent *ent;
+	ino_t ino;
 
 	if ( !autofs_oz_mode(sbi) )
 		return -EPERM;
@@ -407,6 +409,7 @@
 		printk("autofs: Out of inode numbers -- what the heck did you do??\n");
 		return -ENOSPC;
 	}
+	ino = sbi->next_dir_ino++;
 
 	ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL);
 	if ( !ent )
@@ -418,14 +421,14 @@
 		return -ENOSPC;
 	}
 
-	dir->i_nlink++;
-	d_instantiate(dentry, iget(dir->i_sb,ent->ino));
-
 	ent->hash = dentry->d_name.hash;
 	memcpy(ent->name, dentry->d_name.name, 1+(ent->len = dentry->d_name.len));
-	ent->ino = sbi->next_dir_ino++;
+	ent->ino = ino;
 	ent->dentry = dentry;
 	autofs_hash_insert(dh,ent);
+
+	dir->i_nlink++;
+	d_instantiate(dentry, iget(dir->i_sb,ino));
 
 	return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov