From eca449a97a37445f3615dc58b19f85678db04a27 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 20 Dec 2012 15:05:24 -0800 Subject: [PATCH] --- yaml --- r: 347877 b: refs/heads/master c: 5daa669c80c121ab75ecdf1c8e2df52f072fd25e h: refs/heads/master i: 347875: 8acf75d68e8a64039dafb68b625a1f72127ecd75 v: v3 --- [refs] | 2 +- trunk/fs/hfsplus/bitmap.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 3114c55a2fa4..78909a758057 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 44fd07e989a9a27476d8963296688127a4fd4df4 +refs/heads/master: 5daa669c80c121ab75ecdf1c8e2df52f072fd25e diff --git a/trunk/fs/hfsplus/bitmap.c b/trunk/fs/hfsplus/bitmap.c index 4cfbe2edd296..6feefc0cb48a 100644 --- a/trunk/fs/hfsplus/bitmap.c +++ b/trunk/fs/hfsplus/bitmap.c @@ -176,12 +176,14 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); /* are all of the bits in range? */ if ((offset + count) > sbi->total_blocks) - return -2; + return -ENOENT; mutex_lock(&sbi->alloc_mutex); mapping = sbi->alloc_file->i_mapping; pnr = offset / PAGE_CACHE_BITS; page = read_mapping_page(mapping, pnr, NULL); + if (IS_ERR(page)) + goto kaboom; pptr = kmap(page); curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; end = pptr + PAGE_CACHE_BITS / 32; @@ -214,6 +216,8 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) set_page_dirty(page); kunmap(page); page = read_mapping_page(mapping, ++pnr, NULL); + if (IS_ERR(page)) + goto kaboom; pptr = kmap(page); curr = pptr; end = pptr + PAGE_CACHE_BITS / 32; @@ -232,4 +236,11 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) mutex_unlock(&sbi->alloc_mutex); return 0; + +kaboom: + printk(KERN_CRIT "hfsplus: unable to mark blocks free: error %ld\n", + PTR_ERR(page)); + mutex_unlock(&sbi->alloc_mutex); + + return -EIO; }