mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
A fix to avoid triggering an assert in some cases where RBD exclusive
mappings are involved and a deprecated API cleanup. -----BEGIN PGP SIGNATURE----- iQFHBAABCAAxFiEEydHwtzie9C7TfviiSn/eOAIR84sFAmWxcDcTHGlkcnlvbW92 QGdtYWlsLmNvbQAKCRBKf944AhHzi63lB/4/LCzIsbGLi52U2exy4yObQ4a7gpQB /zTrf7jlJAc4f+5zNUd4OgFUGK1UcLr3SC3R4CCXwHI8tqepEG1v9NtmtILBxIzu 9r7NjVAwvi7qUirRZvsXwvB+uQJeSfOCtOe7+JFNi+BpT303NbvOiPIXHE1YqATs rXZo+7Z7kHxSP9lRTvJu0q/DRS1EBZSJy2eOgNIj6uwLFe49h++XACHnpsOQaO0I OcuMcQgol5evBbd7hQyrOb4h5BYlLEFY8iMrwaRQ04KCW4yJxvlTviom7tYe9GaU xeJtADE1c6SdeV2orU5OsPEQ7BsLoUWcc+vSaPYq/1WmH+IJ5wtNP8RI =wGB5 -----END PGP SIGNATURE----- Merge tag 'ceph-for-6.8-rc2' of https://github.com/ceph/ceph-client Pull ceph fixes from Ilya Dryomov: "A fix to avoid triggering an assert in some cases where RBD exclusive mappings are involved and a deprecated API cleanup" * tag 'ceph-for-6.8-rc2' of https://github.com/ceph/ceph-client: rbd: don't move requests to the running list on errors rbd: remove usage of the deprecated ida_simple_*() API
This commit is contained in:
commit
6098d87eaf
|
|
@ -3452,14 +3452,15 @@ static bool rbd_lock_add_request(struct rbd_img_request *img_req)
|
|||
static void rbd_lock_del_request(struct rbd_img_request *img_req)
|
||||
{
|
||||
struct rbd_device *rbd_dev = img_req->rbd_dev;
|
||||
bool need_wakeup;
|
||||
bool need_wakeup = false;
|
||||
|
||||
lockdep_assert_held(&rbd_dev->lock_rwsem);
|
||||
spin_lock(&rbd_dev->lock_lists_lock);
|
||||
rbd_assert(!list_empty(&img_req->lock_item));
|
||||
list_del_init(&img_req->lock_item);
|
||||
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING &&
|
||||
list_empty(&rbd_dev->running_list));
|
||||
if (!list_empty(&img_req->lock_item)) {
|
||||
list_del_init(&img_req->lock_item);
|
||||
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING &&
|
||||
list_empty(&rbd_dev->running_list));
|
||||
}
|
||||
spin_unlock(&rbd_dev->lock_lists_lock);
|
||||
if (need_wakeup)
|
||||
complete(&rbd_dev->releasing_wait);
|
||||
|
|
@ -3842,14 +3843,19 @@ static void wake_lock_waiters(struct rbd_device *rbd_dev, int result)
|
|||
return;
|
||||
}
|
||||
|
||||
list_for_each_entry(img_req, &rbd_dev->acquiring_list, lock_item) {
|
||||
while (!list_empty(&rbd_dev->acquiring_list)) {
|
||||
img_req = list_first_entry(&rbd_dev->acquiring_list,
|
||||
struct rbd_img_request, lock_item);
|
||||
mutex_lock(&img_req->state_mutex);
|
||||
rbd_assert(img_req->state == RBD_IMG_EXCLUSIVE_LOCK);
|
||||
if (!result)
|
||||
list_move_tail(&img_req->lock_item,
|
||||
&rbd_dev->running_list);
|
||||
else
|
||||
list_del_init(&img_req->lock_item);
|
||||
rbd_img_schedule(img_req, result);
|
||||
mutex_unlock(&img_req->state_mutex);
|
||||
}
|
||||
|
||||
list_splice_tail_init(&rbd_dev->acquiring_list, &rbd_dev->running_list);
|
||||
}
|
||||
|
||||
static bool locker_equal(const struct ceph_locker *lhs,
|
||||
|
|
@ -5326,7 +5332,7 @@ static void rbd_dev_release(struct device *dev)
|
|||
|
||||
if (need_put) {
|
||||
destroy_workqueue(rbd_dev->task_wq);
|
||||
ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id);
|
||||
ida_free(&rbd_dev_id_ida, rbd_dev->dev_id);
|
||||
}
|
||||
|
||||
rbd_dev_free(rbd_dev);
|
||||
|
|
@ -5402,9 +5408,9 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
|
|||
return NULL;
|
||||
|
||||
/* get an id and fill in device name */
|
||||
rbd_dev->dev_id = ida_simple_get(&rbd_dev_id_ida, 0,
|
||||
minor_to_rbd_dev_id(1 << MINORBITS),
|
||||
GFP_KERNEL);
|
||||
rbd_dev->dev_id = ida_alloc_max(&rbd_dev_id_ida,
|
||||
minor_to_rbd_dev_id(1 << MINORBITS) - 1,
|
||||
GFP_KERNEL);
|
||||
if (rbd_dev->dev_id < 0)
|
||||
goto fail_rbd_dev;
|
||||
|
||||
|
|
@ -5425,7 +5431,7 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
|
|||
return rbd_dev;
|
||||
|
||||
fail_dev_id:
|
||||
ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id);
|
||||
ida_free(&rbd_dev_id_ida, rbd_dev->dev_id);
|
||||
fail_rbd_dev:
|
||||
rbd_dev_free(rbd_dev);
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user