From: Christoph Hellwig <hch@lst.de>
To: stable@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, Brian Foster <bfoster@redhat.com>,
"Darrick J . Wong" <darrick.wong@oracle.com>
Subject: [PATCH 09/23] xfs: support ability to wait on new inodes
Date: Sat, 3 Jun 2017 15:10:49 +0200 [thread overview]
Message-ID: <20170603131103.23712-10-hch@lst.de> (raw)
In-Reply-To: <20170603131103.23712-1-hch@lst.de>
From: Brian Foster <bfoster@redhat.com>
commit 756baca27fff3ecaeab9dbc7a5ee35a1d7bc0c7f upstream.
Inodes that are inserted into the perag tree but still under
construction are flagged with the XFS_INEW bit. Most contexts either
skip such inodes when they are encountered or have the ability to
handle them.
The runtime quotaoff sequence introduces a context that must wait
for construction of such inodes to correctly ensure that all dquots
in the fs are released. In anticipation of this, support the ability
to wait on new inodes. Wake the appropriate bit when XFS_INEW is
cleared.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_icache.c | 5 ++++-
fs/xfs/xfs_inode.h | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 3531f8f72fa5..25f4f4595821 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -366,14 +366,17 @@ xfs_iget_cache_hit(
error = xfs_reinit_inode(mp, inode);
if (error) {
+ bool wake;
/*
* Re-initializing the inode failed, and we are in deep
* trouble. Try to re-add it to the reclaim list.
*/
rcu_read_lock();
spin_lock(&ip->i_flags_lock);
-
+ wake = !!__xfs_iflags_test(ip, XFS_INEW);
ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM);
+ if (wake)
+ wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
ASSERT(ip->i_flags & XFS_IRECLAIMABLE);
trace_xfs_iget_reclaim_fail(ip);
goto out_error;
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 10dcf27b4c85..10e89fcb49d7 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -216,7 +216,8 @@ static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
#define XFS_IRECLAIM (1 << 0) /* started reclaiming this inode */
#define XFS_ISTALE (1 << 1) /* inode has been staled */
#define XFS_IRECLAIMABLE (1 << 2) /* inode can be reclaimed */
-#define XFS_INEW (1 << 3) /* inode has just been allocated */
+#define __XFS_INEW_BIT 3 /* inode has just been allocated */
+#define XFS_INEW (1 << __XFS_INEW_BIT)
#define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */
#define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */
#define __XFS_IFLOCK_BIT 7 /* inode is being flushed right now */
@@ -464,6 +465,7 @@ static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
xfs_iflags_clear(ip, XFS_INEW);
barrier();
unlock_new_inode(VFS_I(ip));
+ wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
}
static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
--
2.11.0
next prev parent reply other threads:[~2017-06-03 13:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-03 13:10 4.11-stable updates for XFS Christoph Hellwig
2017-06-03 13:10 ` [PATCH 01/23] xfs: use dedicated log worker wq to avoid deadlock with cil wq Christoph Hellwig
2017-06-03 13:10 ` [PATCH 02/23] xfs: fix over-copying of getbmap parameters from userspace Christoph Hellwig
2017-06-03 13:10 ` [PATCH 03/23] xfs: actually report xattr extents via iomap Christoph Hellwig
2017-06-03 13:10 ` [PATCH 04/23] xfs: drop iolock from reclaim context to appease lockdep Christoph Hellwig
2017-06-03 13:10 ` [PATCH 05/23] xfs: fix integer truncation in xfs_bmap_remap_alloc Christoph Hellwig
2017-06-03 13:10 ` [PATCH 06/23] xfs: handle array index overrun in xfs_dir2_leaf_readbuf() Christoph Hellwig
2017-06-03 13:10 ` [PATCH 07/23] xfs: prevent multi-fsb dir readahead from reading random blocks Christoph Hellwig
2017-06-03 13:10 ` [PATCH 08/23] xfs: fix up quotacheck buffer list error handling Christoph Hellwig
2017-06-03 13:10 ` Christoph Hellwig [this message]
2017-06-03 13:10 ` [PATCH 10/23] xfs: update ag iterator to support wait on new inodes Christoph Hellwig
2017-06-03 13:10 ` [PATCH 11/23] xfs: wait on new inodes during quotaoff dquot release Christoph Hellwig
2017-06-03 13:10 ` [PATCH 12/23] xfs: reserve enough blocks to handle btree splits when remapping Christoph Hellwig
2017-06-03 13:10 ` [PATCH 13/23] xfs: fix use-after-free in xfs_finish_page_writeback Christoph Hellwig
2017-06-03 13:10 ` [PATCH 14/23] xfs: fix indlen accounting error on partial delalloc conversion Christoph Hellwig
2017-06-03 13:10 ` [PATCH 15/23] xfs: BMAPX shouldn't barf on inline-format directories Christoph Hellwig
2017-06-03 13:10 ` [PATCH 16/23] xfs: bad assertion for delalloc an extent that start at i_size Christoph Hellwig
2017-06-03 13:10 ` [PATCH 17/23] xfs: xfs_trans_alloc_empty Christoph Hellwig
2017-06-03 13:10 ` [PATCH 18/23] xfs: avoid mount-time deadlock in CoW extent recovery Christoph Hellwig
2017-06-03 13:10 ` [PATCH 19/23] xfs: fix unaligned access in xfs_btree_visit_blocks Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2017-06-03 13:14 4.11-stable updates for XFS Christoph Hellwig
2017-06-03 13:14 ` [PATCH 09/23] xfs: support ability to wait on new inodes 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=20170603131103.23712-10-hch@lst.de \
--to=hch@lst.de \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).