From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: stable-review@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
greg@kroah.com, Christoph Hellwig <hch@lst.de>
Subject: [19/27] xfs: force the log if we encounter pinned buffers in .iop_pushbuf
Date: Sun, 23 Oct 2011 08:24:47 +0200 [thread overview]
Message-ID: <20111023062540.221964043@pistachio.kroah.org> (raw)
In-Reply-To: <20111023062833.GA8126@kroah.com>
3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christoph Hellwig <hch@infradead.org>
commit 17b38471c3c07a49f0bbc2ecc2e92050c164e226 upstream
We need to check for pinned buffers even in .iop_pushbuf given that inode
items flush into the same buffers that may be pinned directly due operations
on the unlinked inode list operating directly on buffers. To do this add a
return value to .iop_pushbuf that tells the AIL push about this and use
the existing log force mechanisms to unpin it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Tested-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/xfs/quota/xfs_dquot_item.c | 10 +++++++---
fs/xfs/xfs_buf_item.c | 3 ++-
fs/xfs/xfs_inode_item.c | 10 +++++++---
fs/xfs/xfs_trans.h | 2 +-
fs/xfs/xfs_trans_ail.c | 9 +++++++--
5 files changed, 24 insertions(+), 10 deletions(-)
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -183,13 +183,14 @@ xfs_qm_dqunpin_wait(
* search the buffer cache can be a time consuming thing, and AIL lock is a
* spinlock.
*/
-STATIC void
+STATIC bool
xfs_qm_dquot_logitem_pushbuf(
struct xfs_log_item *lip)
{
struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip);
struct xfs_dquot *dqp = qlip->qli_dquot;
struct xfs_buf *bp;
+ bool ret = true;
ASSERT(XFS_DQ_IS_LOCKED(dqp));
@@ -201,17 +202,20 @@ xfs_qm_dquot_logitem_pushbuf(
if (completion_done(&dqp->q_flush) ||
!(lip->li_flags & XFS_LI_IN_AIL)) {
xfs_dqunlock(dqp);
- return;
+ return true;
}
bp = xfs_incore(dqp->q_mount->m_ddev_targp, qlip->qli_format.qlf_blkno,
dqp->q_mount->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK);
xfs_dqunlock(dqp);
if (!bp)
- return;
+ return true;
if (XFS_BUF_ISDELAYWRITE(bp))
xfs_buf_delwri_promote(bp);
+ if (XFS_BUF_ISPINNED(bp))
+ ret = false;
xfs_buf_relse(bp);
+ return ret;
}
/*
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -632,7 +632,7 @@ xfs_buf_item_push(
* the xfsbufd to get this buffer written. We have to unlock the buffer
* to allow the xfsbufd to write it, too.
*/
-STATIC void
+STATIC bool
xfs_buf_item_pushbuf(
struct xfs_log_item *lip)
{
@@ -646,6 +646,7 @@ xfs_buf_item_pushbuf(
xfs_buf_delwri_promote(bp);
xfs_buf_relse(bp);
+ return true;
}
STATIC void
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -713,13 +713,14 @@ xfs_inode_item_committed(
* marked delayed write. If that's the case, we'll promote it and that will
* allow the caller to write the buffer by triggering the xfsbufd to run.
*/
-STATIC void
+STATIC bool
xfs_inode_item_pushbuf(
struct xfs_log_item *lip)
{
struct xfs_inode_log_item *iip = INODE_ITEM(lip);
struct xfs_inode *ip = iip->ili_inode;
struct xfs_buf *bp;
+ bool ret = true;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
@@ -730,7 +731,7 @@ xfs_inode_item_pushbuf(
if (completion_done(&ip->i_flush) ||
!(lip->li_flags & XFS_LI_IN_AIL)) {
xfs_iunlock(ip, XFS_ILOCK_SHARED);
- return;
+ return true;
}
bp = xfs_incore(ip->i_mount->m_ddev_targp, iip->ili_format.ilf_blkno,
@@ -738,10 +739,13 @@ xfs_inode_item_pushbuf(
xfs_iunlock(ip, XFS_ILOCK_SHARED);
if (!bp)
- return;
+ return true;
if (XFS_BUF_ISDELAYWRITE(bp))
xfs_buf_delwri_promote(bp);
+ if (XFS_BUF_ISPINNED(bp))
+ ret = false;
xfs_buf_relse(bp);
+ return ret;
}
/*
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -350,7 +350,7 @@ typedef struct xfs_item_ops {
void (*iop_unlock)(xfs_log_item_t *);
xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
void (*iop_push)(xfs_log_item_t *);
- void (*iop_pushbuf)(xfs_log_item_t *);
+ bool (*iop_pushbuf)(xfs_log_item_t *);
void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
} xfs_item_ops_t;
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -478,8 +478,13 @@ xfs_ail_worker(
case XFS_ITEM_PUSHBUF:
XFS_STATS_INC(xs_push_ail_pushbuf);
- IOP_PUSHBUF(lip);
- ailp->xa_last_pushed_lsn = lsn;
+
+ if (!IOP_PUSHBUF(lip)) {
+ stuck++;
+ flush_log = 1;
+ } else {
+ ailp->xa_last_pushed_lsn = lsn;
+ }
push_xfsbufd = 1;
break;
next prev parent reply other threads:[~2011-10-23 6:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-23 6:28 [00/27] 3.0.8-stable review Greg KH
2011-10-23 6:24 ` [01/27] ARM: 7113/1: mm: Align bank start to MAX_ORDER_NR_PAGES Greg KH
2011-10-23 6:24 ` [02/27] ARM: 7117/1: perf: fix HW_CACHE_* events on Cortex-A9 Greg KH
2011-10-23 6:24 ` [03/27] HID: usbhid: Add support for SiGma Micro chip Greg KH
2011-10-23 6:24 ` [04/27] hwmon: (w83627ehf) Properly report thermal diode sensors Greg KH
2011-10-23 6:24 ` [05/27] Avoid using variable-length arrays in kernel/sys.c Greg KH
2011-10-23 6:24 ` [06/27] drm/radeon/kms/atom: fix handling of FB scratch indices Greg KH
2011-10-23 6:24 ` [07/27] cputimer: Cure lock inversion Greg KH
2011-10-23 6:24 ` [08/27] fuse: fix memory leak Greg KH
2011-10-23 6:24 ` [09/27] Platform: fix samsung-laptop DMI identification for N150/N210/220/N230 Greg KH
2011-10-23 6:24 ` [10/27] HID: magicmouse: ignore ivalid report id while switching modes, v2 Greg KH
2011-10-23 6:24 ` [11/27] [media] uvcvideo: Fix crash when linking entities Greg KH
2011-10-23 6:24 ` [12/27] hfsplus: ensure bio requests are not smaller than the hardware sectors Greg KH
2011-10-23 6:24 ` [13/27] drm/ttm: ensure ttm for new node is bound before calling move_notify() Greg KH
2011-10-23 6:24 ` [14/27] drm/ttm: unbind ttm before destroying node in accel move cleanup Greg KH
2011-10-23 6:24 ` [15/27] CIFS: Fix ERR_PTR dereference in cifs_get_root Greg KH
2011-10-23 6:24 ` [16/27] xfs: start periodic workers later Greg KH
2011-10-23 6:24 ` [17/27] xfs: use a cursor for bulk AIL insertion Greg KH
2011-10-23 6:24 ` [18/27] xfs: do not update xa_last_pushed_lsn for locked items Greg KH
2011-10-23 6:24 ` Greg KH [this message]
2011-10-23 6:24 ` [20/27] xfs: revert to using a kthread for AIL pushing Greg KH
2011-10-23 6:24 ` [21/27] firewire: sbp2: fix panic after rmmod with slow targets Greg KH
2011-10-23 6:24 ` [22/27] VFS: Fix automount for negative autofs dentries Greg KH
2011-10-23 7:35 ` Linus Torvalds
2011-10-23 8:36 ` Greg KH
2011-10-23 21:09 ` Miklos Szeredi
2011-10-24 14:22 ` Greg KH
2011-10-23 11:59 ` Ian Kent
2011-11-01 15:51 ` David Howells
2011-10-23 11:41 ` Ian Kent
2011-10-23 11:48 ` Greg KH
2011-10-23 12:07 ` Ian Kent
2011-10-23 6:24 ` [23/27] mm: fix race between mremap and removing migration entry Greg KH
2011-10-23 6:24 ` [24/27] x25: Prevent skb overreads when checking call user data Greg KH
2011-10-23 6:24 ` [25/27] crypto: ghash - Avoid null pointer dereference if no key is set Greg KH
2011-10-23 6:24 ` [26/27] ALSA: HDA: conexant support for Lenovo T520/W520 Greg KH
2011-10-23 6:24 ` [27/27] ALSA: hda - Add position_fix quirk for Dell Inspiron 1010 Greg KH
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=20111023062540.221964043@pistachio.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-review@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®