[PATCH] device-mapper: [3/5] Let freeze_bdev return error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow freeze_bdev() to return an error.

Signed-Off-By: Alasdair G Kergon <[email protected]>
From: Christoph Hellwig <[email protected]>
--- diff/drivers/md/dm.c	2005-04-21 16:07:21.000000000 +0100
+++ source/drivers/md/dm.c	2005-04-21 16:08:10.000000000 +0100
@@ -991,22 +991,38 @@
  */
 static int __lock_fs(struct mapped_device *md)
 {
+	int error = -ENOMEM;
+
 	if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
 		return 0;
 
 	md->frozen_bdev = bdget_disk(md->disk, 0);
 	if (!md->frozen_bdev) {
 		DMWARN("bdget failed in __lock_fs");
-		return -ENOMEM;
+		goto out;
 	}
 
 	WARN_ON(md->frozen_sb);
+
 	md->frozen_sb = freeze_bdev(md->frozen_bdev);
+	if (IS_ERR(md->frozen_sb)) {
+		error = PTR_ERR(md->frozen_sb);
+		goto out_bdput;
+	}
+
 	/* don't bdput right now, we don't want the bdev
 	 * to go away while it is locked.  We'll bdput
 	 * in __unlock_fs
 	 */
 	return 0;
+
+out_bdput:
+	bdput(md->frozen_bdev);
+	md->frozen_sb = NULL;
+	md->frozen_bdev = NULL;
+out:
+	clear_bit(DMF_FS_LOCKED, &md->flags);
+	return error;
 }
 
 static void __unlock_fs(struct mapped_device *md)
-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux