public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/3] xfs: don't ever put nlink > 0 inodes on the unlinked list
Date: Thu, 14 Feb 2019 08:03:40 -0800	[thread overview]
Message-ID: <20190214160340.GI32253@magnolia> (raw)
In-Reply-To: <20190214081556.GB5961@infradead.org>

On Thu, Feb 14, 2019 at 12:15:56AM -0800, Christoph Hellwig wrote:
> On Wed, Feb 13, 2019 at 12:50:53PM -0800, Darrick J. Wong wrote:
> > +	if (tmpfile) {
> > +		/*
> > +		 * The VFS requires that any inode fed to d_tmpfile must have
> > +		 * nlink == 1 so that it can decrement the nlink in d_tmpfile.
> > +		 * However, we created the temp file with nlink == 0 because
> > +		 * we're not allowed to put an inode with nlink > 0 on the
> > +		 * unlinked list.  Therefore we have to set nlink to 1 so that
> > +		 * d_tmpfile can immediately set it back to zero.
> > +		 */
> > +		set_nlink(inode, 1);
> >  		d_tmpfile(dentry, inode);
> > +	} else
> 
> At least btrtfs has to work around these d_tmpfile assumptions as well.
> Instead of piling hacks over hacks I'd rather move the call to
> inode_dec_link_count from d_tmpfile, which should lead to a saner
> interface.

I'm working on a bigger change to fix the d_tmpfile behavior, but that's
a complex multi-fs change that may or may not make it for 5.1. :(

In the meantime this prevents leaking inodes during unlink recovery by
ensuring that we never put linked inodes on the unlink list so I would
still like to get this one reviewed. :)

--D

  reply	other threads:[~2019-02-14 16:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 20:50 [PATCH 1/3] xfs: don't overflow xattr listent buffer Darrick J. Wong
2019-02-13 20:50 ` [PATCH 2/3] xfs: don't ever put nlink > 0 inodes on the unlinked list Darrick J. Wong
2019-02-14  8:15   ` Christoph Hellwig
2019-02-14 16:03     ` Darrick J. Wong [this message]
2019-02-14 21:41   ` Christoph Hellwig
2019-02-13 20:50 ` [PATCH 3/3] xfs: reserve blocks for ifree transaction during log recovery Darrick J. Wong
2019-02-14  8:17   ` Christoph Hellwig
2019-02-14 15:58     ` Darrick J. Wong
2019-02-13 20:58 ` [PATCH 1/3] xfs: don't overflow xattr listent buffer Darrick J. Wong
2019-06-27 16:12   ` [STABLE 4.19] fixes for xfs memory and fs corruption Amir Goldstein
2019-06-27 17:08     ` Darrick J. Wong
2019-06-27 23:32     ` Sasha Levin
2019-07-03  2:47       ` Sasha Levin
2019-02-14  8:11 ` [PATCH 1/3] xfs: don't overflow xattr listent buffer Christoph Hellwig

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=20190214160340.GI32253@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.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