Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4616575ybi; Sat, 20 Jul 2019 02:43:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkx2Qu3CAjwt+znhQGWF2/T1B67cLFVJMQyUq2m6TnVLRA+jDi2T1+P2HFtxhciiNg8eMJ X-Received: by 2002:a17:902:925:: with SMTP id 34mr61563628plm.334.1563615805569; Sat, 20 Jul 2019 02:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563615805; cv=none; d=google.com; s=arc-20160816; b=cZ3xf9N7RItG/oahjkBtPpv/vFX4WHr6EiwwQACcHfOWY1F2aFFq7+6AI4DxiNXZNf J+CEzj4au8KXCHsPlvVgAg0VmN0cu7jUzmrRCxf3hpF486znNH9QL+Rug093W954yrem ap3ks1ieK4ydEb8xbcddZWJtpOtymzyZybpIWg50uvjR2B2/kRksCEMBQHvUWiL6Tq1v VoeJm1PF6HQXmf7AH4c2Nbj/u13Z3ADw4w3hvfUgItJY2Jx9AqziblwqSzcSQLC6NZvY BrXMRqG4HFRYl2h1g1BlzkqZqOakVCTMSHaUkRAvtJ+7ipG3AfKdcqQXehon9LVkvqwL uaJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7oLnTRp3twCFdfAOPz1cbzsh5pmh1GTSaMtRSojF5IY=; b=oM+UOAMCDVz32hO7wPeI0g6gGPllXLeb3l6vg4XEUmSNTVzlI1hA3Efmblg0zIKjpQ N8euEfRm2bSDLOIL3aJoml4Q0xapevjbc9NBCeyxW4LlNqoj0Ir35aEgoJjC6ErLgMd/ e+dkZ8+PKtzI4ugimyyiEOtIkq1zNCaLWx2US6vIF0Xtcf5g2N5CRfEPH7ugWSpyOfij 7ppATwB5vAfdbv5y+f3Hy3H+WIYBO+eb2Iq3Sdsm4ez1EGLaygvrgwQMys+fEo/qURWm Vq4AA2CeCvFGS3gpJobwpgaEoG8pd+/FoC4FeN5frhujkqoJNavsJ8rTsTuZkpBwqs0T AsYQ== 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 h4si4493139plt.30.2019.07.20.02.43.09; Sat, 20 Jul 2019 02:43: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; 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 S1732903AbfGSXai (ORCPT + 99 others); Fri, 19 Jul 2019 19:30:38 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:41416 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728909AbfGSXai (ORCPT ); Fri, 19 Jul 2019 19:30:38 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hocKe-0006qC-Fp; Fri, 19 Jul 2019 23:30:32 +0000 Date: Sat, 20 Jul 2019 00:30:32 +0100 From: Al Viro To: Jeff Layton Cc: Luis Henriques , Ilya Dryomov , Sage Weil , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] ceph: fix buffer free while holding i_ceph_lock in __ceph_setxattr() Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190719232307.GA17978@ZenIV.linux.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.