patch-2.3.10 linux/fs/ufs/balloc.c

Next file: linux/fs/ufs/super.c
Previous file: linux/fs/sysv/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/fs/ufs/balloc.c linux/fs/ufs/balloc.c
@@ -360,14 +360,22 @@
 	if (result) {
 		for (i = 0; i < oldcount; i++) {
 			bh = bread (sb->s_dev, tmp + i, sb->s_blocksize);
-			mark_buffer_clean (bh);
-			bh->b_blocknr = result + i;
-			mark_buffer_dirty (bh, 0);
-			if (IS_SYNC(inode)) {
-				ll_rw_block (WRITE, 1, &bh);
-				wait_on_buffer (bh);
+			if(bh)
+			{
+				mark_buffer_clean (bh);
+				bh->b_blocknr = result + i;
+				mark_buffer_dirty (bh, 0);
+				if (IS_SYNC(inode)) {
+					ll_rw_block (WRITE, 1, &bh);
+					wait_on_buffer (bh);
+				}
+				brelse (bh);
+			}
+			else
+			{
+				printk(KERN_ERR "ufs_new_fragments: bread fail\n");
+				return 0;
 			}
-			brelse (bh);
 		}
 		*p = SWAB32(result);
 		*err = 0;

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