mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Luis Henriques <lhenriques@suse.com>,
	Ilya Dryomov <idryomov@gmail.com>, Sage Weil <sage@redhat.com>,
	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()
Date: Fri, 19 Jul 2019 20:35:39 -0400	[thread overview]
Message-ID: <3925c4f98ea836b53f8c0e325d6e4334f3436f86.camel@kernel.org> (raw)
In-Reply-To: <20190719233032.GB17978@ZenIV.linux.org.uk>

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 <jlayton@kernel.org>


  reply	other threads:[~2019-07-20  0:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 14:32 [PATCH 0/4] Sleeping functions in invalid context bug fixes Luis Henriques
2019-07-19 14:32 ` [PATCH 1/4] libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer Luis Henriques
2019-07-19 14:32 ` [PATCH 2/4] ceph: fix buffer free while holding i_ceph_lock in __ceph_setxattr() Luis Henriques
2019-07-19 23:07   ` Jeff Layton
2019-07-19 23:23     ` Al Viro
2019-07-19 23:30       ` Al Viro
2019-07-20  0:35         ` Jeff Layton [this message]
2019-07-19 14:32 ` [PATCH 3/4] ceph: fix buffer free while holding i_ceph_lock in __ceph_build_xattrs_blob() Luis Henriques
2019-07-19 14:32 ` [PATCH 4/4] ceph: fix buffer free while holding i_ceph_lock in fill_inode() Luis Henriques
2019-07-19 15:20 ` [PATCH 0/4] Sleeping functions in invalid context bug fixes Jeff Layton
2019-07-23 10:02   ` Ilya Dryomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3925c4f98ea836b53f8c0e325d6e4334f3436f86.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=lhenriques@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®