From: Christoph Hellwig <hch@lst.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: david@fromorbit.com, Christoph Hellwig <hch@lst.de>,
linux-xfs@vger.kernel.org,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
pjaroszynski@nvidia.com, william.kucharski@oracle.com,
stable@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] iomap: Revert "fs/iomap.c: get/put the page in iomap_page_create/release()"
Date: Fri, 21 Dec 2018 10:39:19 +0100 [thread overview]
Message-ID: <20181221093919.GA2337@lst.de> (raw)
In-Reply-To: <CAHk-=wgdbrbV+jNUmhJ7KZsR77CY+pUF7EmtxP2mWKnE8ZyFSQ@mail.gmail.com>
On Thu, Dec 20, 2018 at 02:42:15PM -0800, Linus Torvalds wrote:
> Yeah. I already applied the revert. If somebody finds a "duh" moment,
> and an alternate fix gets posted and tested we can revert the revert
> and fix it properly, but for 4.20 (and for xmas) I do think that just
> going back to the previous state is otherwise the right choice.
As far as I can tell the commit simply missed updating the recounts
in the actual migrate callback for which it was added. The fixed
version looks something like this (still running xfstests):
diff --git a/fs/iomap.c b/fs/iomap.c
index d6bc98ae8d35..20c9c1cadd4e 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -116,6 +116,12 @@ iomap_page_create(struct inode *inode, struct page *page)
atomic_set(&iop->read_count, 0);
atomic_set(&iop->write_count, 0);
bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);
+
+ /*
+ * migrate_page_move_mapping() assumes that pages with private data have
+ * their count elevated by 1.
+ */
+ get_page(page);
set_page_private(page, (unsigned long)iop);
SetPagePrivate(page);
return iop;
@@ -132,6 +138,7 @@ iomap_page_release(struct page *page)
WARN_ON_ONCE(atomic_read(&iop->write_count));
ClearPagePrivate(page);
set_page_private(page, 0);
+ put_page(page);
kfree(iop);
}
@@ -556,8 +563,10 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage,
if (page_has_private(page)) {
ClearPagePrivate(page);
+ get_page(newpage);
set_page_private(newpage, page_private(page));
set_page_private(page, 0);
+ put_page(page);
SetPagePrivate(newpage);
}
next prev parent reply other threads:[~2018-12-21 9:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-20 12:23 [PATCH] iomap: Revert "fs/iomap.c: get/put the page in iomap_page_create/release()" Dave Chinner
2018-12-20 12:28 ` Greg KH
2018-12-20 20:57 ` Dave Chinner
2018-12-21 7:40 ` Greg KH
2018-12-21 22:06 ` Eric Sandeen
2018-12-22 0:04 ` Sasha Levin
2018-12-20 17:41 ` Christoph Hellwig
2018-12-20 20:53 ` Dave Chinner
2018-12-20 22:42 ` Linus Torvalds
2018-12-21 9:39 ` Christoph Hellwig [this message]
2018-12-21 19:18 ` Linus Torvalds
2018-12-21 19:20 ` Christoph Hellwig
2018-12-21 19:26 ` Linus Torvalds
2018-12-21 21:58 ` Dave Chinner
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=20181221093919.GA2337@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=pjaroszynski@nvidia.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=william.kucharski@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.