This is a note to let you know that I've just added the patch titled

    rbd: protect against concurrent unmaps

to the 3.10-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rbd-protect-against-concurrent-unmaps.patch
and it can be found in the queue-3.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 82a442d239695a242c4d584464c9606322cd02aa Mon Sep 17 00:00:00 2001
From: Alex Elder <[email protected]>
Date: Fri, 31 May 2013 17:40:44 -0500
Subject: rbd: protect against concurrent unmaps

From: Alex Elder <[email protected]>

commit 82a442d239695a242c4d584464c9606322cd02aa upstream.

Make sure two concurrent unmap operations on the same rbd device
won't collide, by only proceeding with the removal and cleanup of a
device if is not already underway.

Signed-off-by: Alex Elder <[email protected]>
Reviewed-by: Josh Durgin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/block/rbd.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5108,6 +5108,7 @@ static ssize_t rbd_remove(struct bus_typ
        struct list_head *tmp;
        int dev_id;
        unsigned long ul;
+       bool already = false;
        int ret;
 
        ret = strict_strtoul(buf, 10, &ul);
@@ -5135,11 +5136,12 @@ static ssize_t rbd_remove(struct bus_typ
                if (rbd_dev->open_count)
                        ret = -EBUSY;
                else
-                       set_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags);
+                       already = test_and_set_bit(RBD_DEV_FLAG_REMOVING,
+                                                       &rbd_dev->flags);
                spin_unlock_irq(&rbd_dev->lock);
        }
        spin_unlock(&rbd_dev_list_lock);
-       if (ret < 0)
+       if (ret < 0 || already)
                goto done;
 
        rbd_bus_del_dev(rbd_dev);


Patches currently in stable-queue which might be from [email protected] are

queue-3.10/libceph-add-lingering-request-reference-when-registered.patch
queue-3.10/rbd-set-removing-flag-while-holding-list-lock.patch
queue-3.10/rbd-flush-dcache-after-zeroing-page-data.patch
queue-3.10/rbd-protect-against-concurrent-unmaps.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to