diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-28 03:27:06 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-28 03:27:06 +0300 |
commit | 35fab9271b7e6d193b47005c4d07369714db4fd1 (patch) | |
tree | fd004adde50462d752dd90ca3e1c6c664f8f5a1c /drivers/xen/xen-scsiback.c | |
parent | da46b58ff884146f6153064f18d276806f3c114c (diff) | |
parent | cbfac7707ba16619006a4fd60faac46303fd2f3e (diff) | |
download | linux-35fab9271b7e6d193b47005c4d07369714db4fd1.tar.xz |
Merge tag 'for-linus-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from Juergen Gross:
- some cleanups in the Xen blkback driver
- fix potential sleeps under lock in various Xen drivers
* tag 'for-linus-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/blkback: move blkif_get_x86_*_req() into blkback.c
xen/blkback: simplify free_persistent_gnts() interface
xen/blkback: remove stale prototype
xen/blkback: fix white space code style issues
xen/pvcalls: don't call bind_evtchn_to_irqhandler() under lock
xen/scsiback: don't call scsiback_free_translation_entry() under lock
xen/pciback: don't call pcistub_device_put() under lock
Diffstat (limited to 'drivers/xen/xen-scsiback.c')
-rw-r--r-- | drivers/xen/xen-scsiback.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index a7e7e02c415d..8b77e4c06e43 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -1010,12 +1010,6 @@ out_free: return err; } -static void __scsiback_del_translation_entry(struct v2p_entry *entry) -{ - list_del(&entry->l); - kref_put(&entry->kref, scsiback_free_translation_entry); -} - /* Delete the translation entry specified */ @@ -1024,18 +1018,20 @@ static int scsiback_del_translation_entry(struct vscsibk_info *info, { struct v2p_entry *entry; unsigned long flags; - int ret = 0; spin_lock_irqsave(&info->v2p_lock, flags); /* Find out the translation entry specified */ entry = scsiback_chk_translation_entry(info, v); if (entry) - __scsiback_del_translation_entry(entry); - else - ret = -ENOENT; + list_del(&entry->l); spin_unlock_irqrestore(&info->v2p_lock, flags); - return ret; + + if (!entry) + return -ENOENT; + + kref_put(&entry->kref, scsiback_free_translation_entry); + return 0; } static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state, @@ -1239,14 +1235,19 @@ static void scsiback_release_translation_entry(struct vscsibk_info *info) { struct v2p_entry *entry, *tmp; struct list_head *head = &(info->v2p_entry_lists); + struct list_head tmp_list; unsigned long flags; spin_lock_irqsave(&info->v2p_lock, flags); - list_for_each_entry_safe(entry, tmp, head, l) - __scsiback_del_translation_entry(entry); + list_cut_before(&tmp_list, head, head); spin_unlock_irqrestore(&info->v2p_lock, flags); + + list_for_each_entry_safe(entry, tmp, &tmp_list, l) { + list_del(&entry->l); + kref_put(&entry->kref, scsiback_free_translation_entry); + } } static void scsiback_remove(struct xenbus_device *dev) |