Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3942064ybi; Fri, 19 Jul 2019 11:47:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1yjTTzrRgOn+YkIaqj6//wB600Hd6JmIpd6CbxK5dbwbw2Nz1mexou4U9S6+1Fl305xog X-Received: by 2002:a17:90a:8d0c:: with SMTP id c12mr57300166pjo.140.1563562040757; Fri, 19 Jul 2019 11:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563562040; cv=none; d=google.com; s=arc-20160816; b=E6dMYYyB9SFzU3Qf5wvS88ZrSOR4Sr62wjuqQUHfB4Tyjz9EJSgUzfyDX8NqBnC0/2 O7173mQeuOBwpUss0bMXIKhoD0FmgKU4HF+LswrxKl2uUq5zPCC1w/QUi3I1qmzL/3f3 qwpUQGkqnGRfWpqxtWwizG6PGaWQEiPDy5DL6AyRXkXfBK1BjcQEgq5M/ec2NWEYnuu/ 1AnQ5kSBxdNt2rXtxAoXeopdSiAKZ+/5Nyg85OrrfsdFna1UCdkHmIpjkiiiD0wD7W2S 0Z78Cd8WrluP7cGwG1m/1r03eKSMLHo5HBnhmdo9ry4E3mBUYRlXmbFjJ0XwKd1BONFT rKRA== 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=+Vc4r1glvvNVfp8MgM+lh+czInysoLHSmZ8l20UTOpw=; b=p56Im016w1UBTvn0fd1Uza1QsfhMfVN9pOUoDic12BaO5syukyxuW/EIzdleed9AOS hV67JOTdkJbsx1oPuoYRiJ1aSUMVtVVPWWmZ/LssHoWjBuD5hRkEo9EWqNX+rnpIHVRj ikX7sOqHqnuo0ZTywWtdvVQw/KBwaVQ9arXItvrrpYH2950cl1wf6vme9ib5oJqejFQ2 2kjMwEoYjg+443N0xWDRRQYBVEoZ2ba0toDWSQxyNwkBaVw4d1cX2w/NBpvtrJMY53n3 zSMvyNKDn/RGHQRlkr+7+Ew5NvlrbvHEksuF8AbU5Oukmx1m1mjbEaNE7ABEXcvuvKBI KRfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KQLv5u08; 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 d9si4414308pgv.577.2019.07.19.11.47.05; Fri, 19 Jul 2019 11:47:20 -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=KQLv5u08; 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 S1728680AbfGSPUi (ORCPT + 99 others); Fri, 19 Jul 2019 11:20:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:43696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfGSPUh (ORCPT ); Fri, 19 Jul 2019 11:20:37 -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 37F4C2083B; Fri, 19 Jul 2019 15:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563549636; bh=8RmchD2l/bQKOy5engQ2eeDSOmx7TCxD1k24iaIMbZ8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=KQLv5u08yyAKXzEUPKpbKlUHiHHPOt7/5VvYLjgbCzXCT9uiALvaGBrw5N/tqYH1T ioGJNewKrHA6GNGdPdh5gQL3ZS/cmgIw46bWjT+XmDXVD/iJsaqJ4P/JN+wz6pi6ZV h7nLu6bzmRR4LBwP4Xk1fC3LpOHWvkwmJRv4pUBQ= Message-ID: Subject: Re: [PATCH 0/4] Sleeping functions in invalid context bug fixes From: Jeff Layton To: Luis Henriques , Ilya Dryomov , Sage Weil Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 19 Jul 2019 11:20:34 -0400 In-Reply-To: <20190719143222.16058-1-lhenriques@suse.com> References: <20190719143222.16058-1-lhenriques@suse.com> 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 Fri, 2019-07-19 at 15:32 +0100, Luis Henriques wrote: > Hi, > > I'm sending three "sleeping function called from invalid context" bug > fixes that I had on my TODO for a while. All of them are ceph_buffer_put > related, and all the fixes follow the same pattern: delay the operation > until the ci->i_ceph_lock is released. > > The first patch simply allows ceph_buffer_put to receive a NULL buffer so > that the NULL check doesn't need to be performed in all the other patches. > IOW, it's not really required, just convenient. > > (Note: maybe these patches should all be tagged for stable.) > > Luis Henriques (4): > libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer > ceph: fix buffer free while holding i_ceph_lock in __ceph_setxattr() > ceph: fix buffer free while holding i_ceph_lock in > __ceph_build_xattrs_blob() > ceph: fix buffer free while holding i_ceph_lock in fill_inode() > > fs/ceph/caps.c | 5 ++++- > fs/ceph/inode.c | 7 ++++--- > fs/ceph/snap.c | 4 +++- > fs/ceph/super.h | 2 +- > fs/ceph/xattr.c | 19 ++++++++++++++----- > include/linux/ceph/buffer.h | 3 ++- > 6 files changed, 28 insertions(+), 12 deletions(-) This all looks good to me. I'll plan to merge these into the testing branch soon, and tag them for stable. PS: On a related note (and more of a question for Ilya)... I'm wondering if we get any benefit from having our own ceph_kvmalloc routine. Why are we not better off using the stock kvmalloc routine instead? Forcing a vmalloc just because we've gone above 32k allocation doesn't seem like the right thing to do. PPS: I also wonder if we ought to put a might_sleep() in kvfree(). I think that kfree generally doesn't, and I wonder how many uses of this end up using kfree until memory ends up fragmented. -- Jeff Layton