linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Hugh Dickins <hughd@google.com>, Carlos Maiolino <cem@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH vfs.tmpfs] shmem: move spinlock into shmem_recalc_inode() to fix quota support
Date: Mon, 7 Aug 2023 11:34:49 +0200	[thread overview]
Message-ID: <20230807-zuschauen-wachpersonal-6ce2b6002dac@brauner> (raw)
In-Reply-To: <20230807092030.krout2mwwa3yesd4@quack3>

On Mon, Aug 07, 2023 at 11:20:30AM +0200, Jan Kara wrote:
> On Thu 03-08-23 22:46:11, Hugh Dickins wrote:
> > Commit "shmem: fix quota lock nesting in huge hole handling" was not so
> > good: Smatch caught shmem_recalc_inode()'s shmem_inode_unacct_blocks()
> > descending into quota_send_warning(): where blocking GFP_NOFS is used,
> > yet shmem_recalc_inode() is called holding the shmem inode's info->lock.
> > 
> > Yes, both __dquot_alloc_space() and __dquot_free_space() are commented
> > "This operation can block, but only after everything is updated" - when
> > calling flush_warnings() at the end - both its print_warning() and its
> > quota_send_warning() may block.
> > 
> > Rework shmem_recalc_inode() to take the shmem inode's info->lock inside,
> > and drop it before calling shmem_inode_unacct_blocks().
> > 
> > And why were the spin_locks disabling interrupts?  That was just a relic
> > from when shmem_charge() and shmem_uncharge() were called while holding
> > i_pages xa_lock: stop disabling interrupts for info->lock now.
> > 
> > To help stop me from making the same mistake again, add a might_sleep()
> > into shmem_inode_acct_block() and shmem_inode_unacct_blocks(); and those
> > functions have grown, so let the compiler decide whether to inline them.
> > 
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Closes: https://lore.kernel.org/linux-fsdevel/ffd7ca34-7f2a-44ee-b05d-b54d920ce076@moroto.mountain/
> > Signed-off-by: Hugh Dickins <hughd@google.com>
> 
> Thanks for the fix Hugh! The patch looks good to me so feel free to add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Added, thank you!


      reply	other threads:[~2023-08-07  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  5:46 Hugh Dickins
2023-08-04  9:31 ` Christian Brauner
2023-08-07  9:32   ` Carlos Maiolino
2023-08-07  9:34     ` Christian Brauner
2023-08-07  9:20 ` Jan Kara
2023-08-07  9:34   ` Christian Brauner [this message]

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=20230807-zuschauen-wachpersonal-6ce2b6002dac@brauner \
    --to=brauner@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cem@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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