Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4736348ybi; Sat, 20 Jul 2019 05:07:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzneEAkV6Q5fA0XGOWTgSTw31OJv4NVXtGHIN7UPvai+uIiVNG/LRBtG62T+twMQF3DRpaN X-Received: by 2002:a63:4d05:: with SMTP id a5mr55592031pgb.19.1563624445712; Sat, 20 Jul 2019 05:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563624445; cv=none; d=google.com; s=arc-20160816; b=u8f6GdbEG4USUCEB6JW+cNCrxwwHcCVbNJMwxKPfQk1m4sCQCrYrc5QoW4FlNQCtYC 4nbbYA5v54KBABSn3uIoTxSmQmrWLbVsYh5la7isB2ytySGHoEeQ7PLzM9bl5DtoRndQ /j1P9a9YdP2ZDxoXZZqHjy7BylTykmBg93D2fJ0NTg/xxgiT1itnKF5AXMczfvo7Eo5m S8EsYksfm2ego2ScQH5zxI70W5i0gicSYEOcgvrGfRIf0qgxvcNiTcZTW9c5xzJp9enp Ta/Ba7G70BV+Dan5qtEYt18YQQj3TE7JepFnjnP2GU+Xo3f+iWz1vFyf73XIrVuJtcnv G/og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=9ygZFfh+kFgm2MDIHKI/4+sgluyx2/ksIqfOeWmknVg=; b=INsFkRW8BTXowXagK2f+XpxdbQ8uVIPbHlPCkIEl0m6eR3FNsvm/6vNS5mqHn1n638 otTmW8f/fpqkBgqadocfWUU55+VRLXCrKTPc6pKIizMMBKvsi/hDaNs6Hgag1iaQCVEL bdNq9L9C2pg890O4HNrxuyanXcdCwWn2DFB96hJtfWmo06djZczDVNpjbVa4L3dM8b5t 6LoCeCWdyQdti4kux9Tttswdd4hq57jxLvo1780wix2eK/HR7ZqVFWzcVcj5zJXfP+EM 7CZZWNbImY0i8jvNJsLY3gAAZcIEDxuRh04YV5JkzAXJagUapQv+ck63sbrNdi5Pmw+Q +eZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="z20H/jRY"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g191si3867451pgc.331.2019.07.20.05.06.41; Sat, 20 Jul 2019 05:07:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b="z20H/jRY"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390109AbfGTAgj (ORCPT + 99 others); Fri, 19 Jul 2019 20:36:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389904AbfGTAfm (ORCPT ); Fri, 19 Jul 2019 20:35:42 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E94EC21874; Sat, 20 Jul 2019 00:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563582941; bh=9PtDy/ZTq6mqmfYsecqNaovIbWAGNo389ImL2mCZgCk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=z20H/jRY57Eqvw6lTekNSJhyWlpVWsNG3AUzUmGAajjmbjdteBXx0PDFnIdExDHnu pv9bBiA81IvTdyfvNKczPNtGubunLrRhwg0lf9GhEWeQ24la/UhaYWv7OmrHBs1Rj4 o6o/jJH67jy9ndNo8LnVUq4mwDVyg1Qbe2iZmzCk= Message-ID: <3925c4f98ea836b53f8c0e325d6e4334f3436f86.camel@kernel.org> Subject: Re: [PATCH 2/4] ceph: fix buffer free while holding i_ceph_lock in __ceph_setxattr() From: Jeff Layton To: Al Viro Cc: Luis Henriques , Ilya Dryomov , Sage Weil , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 19 Jul 2019 20:35:39 -0400 In-Reply-To: <20190719233032.GB17978@ZenIV.linux.org.uk> References: <20190719143222.16058-1-lhenriques@suse.com> <20190719143222.16058-3-lhenriques@suse.com> <1dee14212043f12ef5b26e4aee0c3155e118abf3.camel@kernel.org> <20190719232307.GA17978@ZenIV.linux.org.uk> <20190719233032.GB17978@ZenIV.linux.org.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2019-07-20 at 00:30 +0100, Al Viro wrote: > On Sat, Jul 20, 2019 at 12:23:08AM +0100, Al Viro wrote: > > On Fri, Jul 19, 2019 at 07:07:49PM -0400, Jeff Layton wrote: > > > > > Al pointed out on IRC that vfree should be callable under spinlock. > > > > Al had been near-terminally low on caffeine at the time, posted > > a retraction a few minutes later and went to grab some coffee... > > > > > It > > > only sleeps if !in_interrupt(), and I think that should return true if > > > we're holding a spinlock. > > > > It can be used from RCU callbacks and all such; it *can't* be used from > > under spinlock - on non-preempt builds there's no way to recognize that. > > Re original patch: looks like the sane way to handle that. > Alternatively, we could add kvfree_atomic() for use in such situations, > but I rather doubt that it's a good idea - not unless you need to free > something under a spinlock held over a large area, which is generally > a bad idea to start with... > > Note that vfree_atomic() has only one caller in the entire tree, > BTW. In that case, I wonder if we ought to add this to the top of kvfree(): might_sleep_if(!in_interrupt()); Might there be other places that are calling it under spinlock that are almost always going down the kfree() path? -- Jeff Layton