Skip to contentSkip to conversation

ext2:delete misused ext2_free_blocks

PATCH Dan Carpenter 2 participants 4 messages Jun 30, 2010 – Jul 1, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Peter Pan

if ext2_new_blocks returns error, no blocks need to be freed.

Hi Peter,

Your patch isn't right. The original code is OK as is.

Are you seeing a kernel panic? Perhaps we can help you fix it.

regards,
dan carpenter

Quoted 29 lines
---
 fs/ext2/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext2/inode.c +2 -2
index 3675088..f858847 100644
@@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
 	ext2_fsblk_t current_block = 0;
 	int ret = 0;
 
+	*err = -ENOSPC;
+
 	/*
 	 * Here we try to allocate the requested multiple blocks at once,
 	 * on a best-effort basis.
@@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
 	*err = 0;
 	return ret;
 failed_out:
-	for (i = 0; i <index; i++)
-		ext2_free_blocks(inode, new_blocks[i], 1);
 	return ret;
 }
 
Signature · 1 line
1.6.6
#2 lore raw
Quoted 11 lines · Dan Carpenter
Quoted 3 lines · Peter Pan

if ext2_new_blocks returns error, no blocks need to be freed.

Hi Peter,

Your patch isn't right. The original code is OK as is.

Are you seeing a kernel panic? Perhaps we can help you fix it.

Oh, I know that the original code is good now. I didn't see a kernel panic, thank you for your guide.

Quoted 31 lines

regards,
dan carpenter

Quoted 27 lines
---
  fs/ext2/inode.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext2/inode.c +2 -2
index 3675088..f858847 100644
@@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
  	ext2_fsblk_t current_block = 0;
  	int ret = 0;
 
+	*err = -ENOSPC;
+
  	/*
  	 * Here we try to allocate the requested multiple blocks at once,
  	 * on a best-effort basis.
@@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
  	*err = 0;
  	return ret;
  failed_out:
-	for (i = 0; i<index; i++)
-		ext2_free_blocks(inode, new_blocks[i], 1);
  	return ret;
  }
 
Quoted 10 lines
Quoted 3 lines
Signature · 1 line
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Regards

Signature · 2 lines
Peter Pan
Red Flag Software Co.,Ltd
#3 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter
Quoted 3 lines · Peter Pan

if ext2_new_blocks returns error, no blocks need to be freed.

Hi Peter,

Your patch isn't right. The original code is OK as is.

Are you seeing a kernel panic? Perhaps we can help you fix it.

Oh, I know that the original code is good now. I didn't see a kernel panic, thank you for your guide.

Quoted 31 lines

regards,
dan carpenter

Quoted 27 lines
---
  fs/ext2/inode.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext2/inode.c +2 -2
index 3675088..f858847 100644
@@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
  	ext2_fsblk_t current_block = 0;
  	int ret = 0;
 
+	*err = -ENOSPC;
+
  	/*
  	 * Here we try to allocate the requested multiple blocks at once,
  	 * on a best-effort basis.
@@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
  	*err = 0;
  	return ret;
  failed_out:
-	for (i = 0; i<index; i++)
-		ext2_free_blocks(inode, new_blocks[i], 1);
  	return ret;
  }
 
Quoted 10 lines
Quoted 3 lines
Signature · 1 line
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Regards

Signature · 2 lines
Peter Pan
Red Flag Software Co.,Ltd
#4 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter
Quoted 3 lines · Peter Pan

if ext2_new_blocks returns error, no blocks need to be freed.

Hi Peter,

Your patch isn't right. The original code is OK as is.

Are you seeing a kernel panic? Perhaps we can help you fix it.

Oh, I know that the original code is good now. I didn't see a kernel panic, thank you for your guide.

Quoted 31 lines

regards,
dan carpenter

Quoted 27 lines
---
  fs/ext2/inode.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext2/inode.c +2 -2
index 3675088..f858847 100644
@@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
  	ext2_fsblk_t current_block = 0;
  	int ret = 0;
 
+	*err = -ENOSPC;
+
  	/*
  	 * Here we try to allocate the requested multiple blocks at once,
  	 * on a best-effort basis.
@@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
  	*err = 0;
  	return ret;
  failed_out:
-	for (i = 0; i<index; i++)
-		ext2_free_blocks(inode, new_blocks[i], 1);
  	return ret;
  }
 
Quoted 10 lines
Quoted 3 lines
Signature · 1 line
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Regards

Signature · 2 lines
Peter Pan
Red Flag Software Co.,Ltd