patch-2.3.27 linux/fs/minix/bitmap.c

Next file: linux/fs/ncpfs/dir.c
Previous file: linux/fs/ext2/ioctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/fs/minix/bitmap.c linux/fs/minix/bitmap.c
@@ -251,13 +251,15 @@
 	struct buffer_head * bh;
 	int i,j;
 
-	if (!dir || !(inode = get_empty_inode()))
+	inode = get_empty_inode();
+	if (!inode)
 		return NULL;
 	sb = dir->i_sb;
 	inode->i_sb = sb;
 	inode->i_flags = 0;
 	j = 8192;
 	bh = NULL;
+	lock_super(sb);
 	for (i = 0; i < sb->u.minix_sb.s_imap_blocks; i++) {
 		bh = inode->i_sb->u.minix_sb.s_imap[i];
 		if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192)
@@ -265,17 +267,20 @@
 	}
 	if (!bh || j >= 8192) {
 		iput(inode);
+		unlock_super(sb);
 		return NULL;
 	}
 	if (minix_set_bit(j,bh->b_data)) {	/* shouldn't happen */
 		printk("new_inode: bit already set");
 		iput(inode);
+		unlock_super(sb);
 		return NULL;
 	}
 	mark_buffer_dirty(bh, 1);
 	j += i*8192;
 	if (!j || j > inode->i_sb->u.minix_sb.s_ninodes) {
 		iput(inode);
+		unlock_super(sb);
 		return NULL;
 	}
 	inode->i_nlink = 1;

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