Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp49158imm; Mon, 14 May 2018 20:42:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrXmSTndt6TU07JhSS6LcerbuQInpPXjYf6uffklplTvHp0666lKaNNAMRxhvqLNOphhykm X-Received: by 2002:a17:902:b286:: with SMTP id u6-v6mr12658852plr.68.1526355749777; Mon, 14 May 2018 20:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526355749; cv=none; d=google.com; s=arc-20160816; b=xjFv9aWGUiXA3P0gVVmXlMlrBAP8SXcMzHcC9/BHXDomLbHpN5JXvHJATWFFCpkZjD I0qpgriIwDCVjdclelbrMYZUMmpXAWujk3lYGTc5AUAO8k9T0q8EAwybz+Hk+gRHRQmO cwTQyls1u76YqeQt8xbYRv8fA/cnncvYEbpo2x/2R8uib3jI59IF/6hIcol2zN5xpMW2 bJdhpcrdO3fXx2JRJFp+vi09jZVDbAOICFVSEonbSvW7FYE8t5UD/MuT1Tp3prV9QzC5 ++QoSArN4Hpi2CiQh2bXeNIXbYgTDJbONSZXZUC3FyJJ76jjB3uOlg6rN+MEVURAu50d jwVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=6pzAUkFN9rZn7BgqYh5m/cr7VF6ErRfPr+A+288Wkaw=; b=XLGOmv+aAJZ3vR4/jPNZIv2GHtjxrAMYPCoWHWAQGg+P4Uf0piZ6YHNeFK5p6XldPq kU6FxWN2NbRrFMEA2hyGgQ1DTZSbdzJPOW3imXowNtAKxwAn4GhieXFbdam43h8j5Oq6 zRNegB0kCO6xf+r4Nk6WCpwqm1d56rM1X0yGRZ5h9Wby+z2QAw5dX7mx7bWKaAv5AQQn oDU2GqUN3iomJQoE1y3TrdZH8C4V7DyZHrszysMvX3gKlyD6eWuirOHj0/ZxyBwY4qcg jnmUDR8fFlU8PvfjlVd9nACpxaWsu0s+LPXxyG+Jgp+KhdahyTmHS8H4NykJsQ61q45r urYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9-v6si11117857pfg.247.2018.05.14.20.42.15; Mon, 14 May 2018 20:42:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbeEODkk (ORCPT + 99 others); Mon, 14 May 2018 23:40:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:55333 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752009AbeEODkj (ORCPT ); Mon, 14 May 2018 23:40:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6B08CAEA2; Tue, 15 May 2018 03:40:38 +0000 (UTC) From: NeilBrown To: James Simmons , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Date: Tue, 15 May 2018 13:40:27 +1000 Cc: Linux Kernel Mailing List , Lustre Development List , Lai Siyao , James Simmons Subject: Re: [PATCH v2] staging: lustre: obdclass: change object lookup to no wait mode In-Reply-To: <1526350548-4402-1-git-send-email-jsimmons@infradead.org> References: <1526350548-4402-1-git-send-email-jsimmons@infradead.org> Message-ID: <87bmdh7fis.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, May 14 2018, James Simmons wrote: > From: Lai Siyao > > Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want > to remove object from cache, but this may lead to deadlock, because > when other process lookup such object, it needs to wait for this > object until release (done at last refcount put), while that process > maybe already hold an LDLM lock. > > Now that current code can handle dying object correctly, we can just > return such object in lookup, thus the above deadlock can be avoided. > > Signed-off-by: Lai Siyao > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9049 > Reviewed-on: https://review.whamcloud.com/26965 > Reviewed-by: Alex Zhuravlev > Tested-by: Cliff White > Reviewed-by: Fan Yong > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons Reviewed-by: NeilBrown Thanks :-) NeilBrown > --- > Changelog: > > v1) Initial patch that didn't apply to staging-testing branch > v2) Rebased after Neil's patches landed. Remove unlikely() test > as requested by Dan Carpenter > > drivers/staging/lustre/lustre/obdclass/lu_object.c | 39 +++++-----------= ------ > 1 file changed, 9 insertions(+), 30 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers= /staging/lustre/lustre/obdclass/lu_object.c > index f14e350..e0abd4f 100644 > --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c > +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c > @@ -593,15 +593,10 @@ static struct lu_object *htable_lookup(struct lu_si= te *s, > const struct lu_fid *f, > __u64 *version) > { > - struct cfs_hash *hs =3D s->ls_obj_hash; > struct lu_site_bkt_data *bkt; > struct lu_object_header *h; > struct hlist_node *hnode; > - __u64 ver; > - wait_queue_entry_t waiter; > - > -retry: > - ver =3D cfs_hash_bd_version_get(bd); > + u64 ver =3D cfs_hash_bd_version_get(bd); >=20=20 > if (*version =3D=3D ver) > return ERR_PTR(-ENOENT); > @@ -618,31 +613,13 @@ static struct lu_object *htable_lookup(struct lu_si= te *s, > } >=20=20 > h =3D container_of(hnode, struct lu_object_header, loh_hash); > - if (likely(!lu_object_is_dying(h))) { > - cfs_hash_get(s->ls_obj_hash, hnode); > - lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT); > - if (!list_empty(&h->loh_lru)) { > - list_del_init(&h->loh_lru); > - percpu_counter_dec(&s->ls_lru_len_counter); > - } > - return lu_object_top(h); > + cfs_hash_get(s->ls_obj_hash, hnode); > + lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT); > + if (!list_empty(&h->loh_lru)) { > + list_del_init(&h->loh_lru); > + percpu_counter_dec(&s->ls_lru_len_counter); > } > - > - /* > - * Lookup found an object being destroyed this object cannot be > - * returned (to assure that references to dying objects are eventually > - * drained), and moreover, lookup has to wait until object is freed. > - */ > - > - init_waitqueue_entry(&waiter, current); > - add_wait_queue(&bkt->lsb_marche_funebre, &waiter); > - set_current_state(TASK_UNINTERRUPTIBLE); > - lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_DEATH_RACE); > - cfs_hash_bd_unlock(hs, bd, 1); > - schedule(); > - remove_wait_queue(&bkt->lsb_marche_funebre, &waiter); > - cfs_hash_bd_lock(hs, bd, 1); > - goto retry; > + return lu_object_top(h); > } >=20=20 > /** > @@ -683,6 +660,8 @@ static void lu_object_limit(const struct lu_env *env,= struct lu_device *dev) > } >=20=20 > /** > + * Core logic of lu_object_find*() functions. > + * > * Much like lu_object_find(), but top level device of object is specifi= cally > * \a dev rather than top level device of the site. This interface allows > * objects of different "stacking" to be created within the same site. > --=20 > 1.8.3.1 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlr6VqwACgkQOeye3VZi gbnLHQ//XwpQhuYbubF114KewUnGrMBgj+tX384BqfXbxS/3ddyj41xQtuDOy7Bd CllvqRhTcJZKRWYCy9vunBNVNJJ/dzXpG0zqeKRf3GK7VrJbMreX4Q+AvOqOfiVz jGpKLJ5prrAKr2FJyMZZrXOrjyI2GQ36kOVjwa01O+UoEdyIXFpRURsFj2I85nrd unTbYL2rEvN0Tx8gqIaQd43APOEFfPHWBg1atifgPXrSN2AoEe30Qq2FwJ7DvanS bM7GFT0Ch63oQ2b+Cmuhj5i6+Evx5O6IOcW2RzJ3orFIS+P6E/Cm+JsIOmRsWUw4 eQKvjR8sYq+DpaOuGb5kaWKTfI+m/W8Jk4hHDwDxfTYcQUxZOxST3HWmGodVKNBf YdTkl/cv0pedAM4QZRanH6PAhpp6V5su4fyQANYM1lAtpZfHb45/ehfnNIw8r8t5 nmmtZ6m3Cd+01rh2PmwdiF8dyt6T/98kcCoKX40yY4G/gfs1NmWebUotfAkRwOYZ yCkFieh/OG+M9pGD1f7kfd8VXfoUOlPstAoCtPDKoepw4c5igze06fZa5/Uyilo2 DykPGZ5tsXHxhr5cyLvb7JMZDCBSOgdici5uO+loRyZgGEdSwg83lx/t37z8dOxz vItkxPZC7kNITUvA0ZyeMRQiOfNtfWXn7x8D7wJAWGRDuXpH5a0= =9IzA -----END PGP SIGNATURE----- --=-=-=--