[dm-devel] Re: [PATCH] dm: fix freeze_bdev() return value check

Akinobu Mita akinobu.mita at gmail.com
Tue Sep 25 14:23:03 UTC 2007


2007/9/24, Akinobu Mita <akinobu.mita at gmail.com>:
> freeze_bdev() does not return errno as pointer on failure.
> This patch fixes the return value check.

I misunderstood the meaning of the return value of freeze_bdev().
I thought NULL returned by freeze_bdev means error. But it is wrong.
freeze_bdev returns NULL when there is no filesystem mounted on the
device with holding bd_mount_sem.
So this patch is totally broken.

But there is no reason to check the return value with IS_ERR().
Because freeze_bdev return NULL or valid super block

Subject: [PATCH] dm: remove freeze_bdev() return value check
From: Akinobu Mita <akinobu.mita at gmail.com>

There is no reason to check the return value with IS_ERR().
Because freeze_bdev return NULL or valid super block.

Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>

---
 drivers/md/dm.c |    7 -------
 1 file changed, 7 deletions(-)

Index: 2.6-git/drivers/md/dm.c
===================================================================
--- 2.6-git.orig/drivers/md/dm.c
+++ 2.6-git/drivers/md/dm.c
@@ -1290,16 +1290,9 @@ out:
  */
 static int lock_fs(struct mapped_device *md)
 {
-	int r;
-
 	WARN_ON(md->frozen_sb);

 	md->frozen_sb = freeze_bdev(md->suspended_bdev);
-	if (IS_ERR(md->frozen_sb)) {
-		r = PTR_ERR(md->frozen_sb);
-		md->frozen_sb = NULL;
-		return r;
-	}

 	set_bit(DMF_FROZEN, &md->flags);




More information about the dm-devel mailing list