Skip to contentSkip to conversation

fix delalloc write_begin failure case

PATCH New Mingming Cao 1 participant 1 message May 9, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix delalloc write_begin failure case

Need to unlock and release the page from page cache if the delalloc write_begin failed.

---
 fs/ext4/inode.c |    5 +++++
 1 file changed, 5 insertions(+)
fs/ext4/inode.c +5 -0
Index: linux-2.6.26-rc1/fs/ext4/inode.c
===================================================================
@@ -1518,6 +1518,11 @@ static int ext4_da_write_begin(struct fi
 
 	ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
 							ext4_da_get_block_prep);
+	if (ret < 0) {
+		unlock_page(page);
+		page_cache_release(page);
+	}
+		
 	return ret;
 }