lkml.org 
[lkml]   [2005]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] device-mapper: [4/5] Handle __lock_fs error
Handle error from __lock_fs()

Signed-Off-By: Alasdair G Kergon <agk@redhat.com>
From: Christoph Hellwig <hch@lst.de>
--- diff/drivers/md/dm.c 2005-04-21 16:08:10.000000000 +0100
+++ source/drivers/md/dm.c 2005-04-21 16:08:19.000000000 +0100
@@ -1048,6 +1048,7 @@
{
struct dm_table *map;
DECLARE_WAITQUEUE(wait, current);
+ int error;

/* Flush I/O to the device. */
down_read(&md->lock);
@@ -1056,25 +1057,29 @@
return -EINVAL;
}

+ error = __lock_fs(md);
+ if (error) {
+ up_read(&md->lock);
+ return error;
+ }
+
map = dm_get_table(md);
if (map)
dm_table_presuspend_targets(map);
- __lock_fs(md);

up_read(&md->lock);

/*
- * First we set the BLOCK_IO flag so no more ios will be
- * mapped.
+ * First we set the BLOCK_IO flag so no more ios will be mapped.
+ *
+ * If the flag is already set we know another thread is trying to
+ * suspend as well, so we leave the fs locked for this thread.
*/
down_write(&md->lock);
if (test_bit(DMF_BLOCK_IO, &md->flags)) {
- /*
- * If we get here we know another thread is
- * trying to suspend as well, so we leave the fs
- * locked for this thread.
- */
up_write(&md->lock);
+ if (map)
+ dm_table_put(map);
return -EINVAL;
}

@@ -1107,6 +1112,7 @@

/* were we interrupted ? */
if (atomic_read(&md->pending)) {
+ /* FIXME Undo the presuspend_targets */
__unlock_fs(md);
clear_bit(DMF_BLOCK_IO, &md->flags);
up_write(&md->lock);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-05-04 19:15    [W:0.196 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site