From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754667AbcBERYt (ORCPT ); Fri, 5 Feb 2016 12:24:49 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:41554 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbcBERYr (ORCPT ); Fri, 5 Feb 2016 12:24:47 -0500 Subject: Re: [PATCH 2/2] xen/scsiback: avoid warnings when adding multiple LUNs to a domain To: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xen.org, konrad.wilk@oracle.com, david.vrabel@citrix.com References: <1454678123-7632-1-git-send-email-jgross@suse.com> <1454678503-7999-1-git-send-email-jgross@suse.com> <1454678503-7999-2-git-send-email-jgross@suse.com> <56B4C4D7.90202@oracle.com> <56B4D50C.3020601@suse.com> Cc: stable@vger.kernel.org From: Boris Ostrovsky Message-ID: <56B4DAD2.4020704@oracle.com> Date: Fri, 5 Feb 2016 12:24:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56B4D50C.3020601@suse.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/05/2016 11:59 AM, Juergen Gross wrote: > On 05/02/16 16:50, Boris Ostrovsky wrote: >> >> On 02/05/2016 08:21 AM, Juergen Gross wrote: >>> When adding more than one LUN to a frontend a warning for a failed >>> assignment is issued in dom0 for each already existing LUN. Avoid this >>> warning. >> Aren't you just factoring out the check? The warning is still printed >> for each scsiback_add_translation_entry() invocation, no? > I don't call scsiback_add_translation_entry() in the critical case. Which is scsiback_do_add_lun()? If yes then perhaps you could mention it in the commit message since there are few changes that this patch provides and it's not clear which is the one that prevents the warning. > > @@ -962,33 +973,31 @@ static int scsiback_del_translation_entry(struct > vscsibk_info *info, > struct ids_tuple *v) > { > struct v2p_entry *entry; > - struct list_head *head = &(info->v2p_entry_lists); > unsigned long flags; > spin_lock_irqsave(&info->v2p_lock, flags); > /* Find out the translation entry specified */ > - list_for_each_entry(entry, head, l) { > - if ((entry->v.chn == v->chn) && > - (entry->v.tgt == v->tgt) && > - (entry->v.lun == v->lun)) { > - goto found; > - } > - } > - > - spin_unlock_irqrestore(&info->v2p_lock, flags); > - return 1; > - > -found: > - /* Delete the translation entry specfied */ > - __scsiback_del_translation_entry(entry); > + entry = scsiback_chk_translation_entry(info, v); > + if (entry) > + __scsiback_del_translation_entry(entry); > spin_unlock_irqrestore(&info->v2p_lock, flags); > - return 0; > + return entry == NULL; >> Might be better to return -ENOENT instead of 1 above and -EEXISTS if >> entry!=NULL, given that this returns an int. > I just didn't want to change more than necessary. In case it is > okay to do some cleanup as well I'd rather change the return type > to "bool". I don't think using error code will require changing anything except the last line above (which is already a change anyway) But using a bool is OK too. -boris