linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Matthew Wilcox <willy@infradead.org>,
	Dan Williams <dan.j.williams@intel.com>
Cc: Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: linux-next: build failure after merge of the xarray tree
Date: Mon, 18 Jun 2018 13:27:12 +1000	[thread overview]
Message-ID: <20180618132712.4b4eddc9@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 6613 bytes --]

Hi all,

After merging the xarray tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

In file included from arch/powerpc/include/asm/bug.h:128:0,
                 from include/linux/bug.h:5,
                 from arch/powerpc/include/asm/cmpxchg.h:9,
                 from arch/powerpc/include/asm/atomic.h:11,
                 from include/linux/atomic.h:5,
                 from fs/dax.c:17:
fs/dax.c: In function 'dax_lock_page':
fs/dax.c:392:21: error: implicit declaration of function 'radix_tree_exceptional_entry'; did you mean 'radix_tree_exception'? [-Werror=implicit-function-declaration]
       WARN_ON_ONCE(!radix_tree_exceptional_entry(entry))) {
                     ^
include/asm-generic/bug.h:69:25: note: in definition of macro 'WARN_ON_ONCE'
  int __ret_warn_on = !!(condition);   \
                         ^~~~~~~~~
fs/dax.c:395:15: error: implicit declaration of function 'slot_locked'; did you mean 'iget_locked'? [-Werror=implicit-function-declaration]
   } else if (!slot_locked(mapping, slot)) {
               ^~~~~~~~~~~
               iget_locked
fs/dax.c:396:4: error: implicit declaration of function 'lock_slot'; did you mean 'local_set'? [-Werror=implicit-function-declaration]
    lock_slot(mapping, slot);
    ^~~~~~~~~
    local_set
fs/dax.c:402:28: error: passing argument 1 of 'dax_entry_waitqueue' from incompatible pointer type [-Werror=incompatible-pointer-types]
   wq = dax_entry_waitqueue(mapping, index, entry, &ewait.key);
                            ^~~~~~~
fs/dax.c:152:27: note: expected 'struct xa_state *' but argument is of type 'struct address_space *'
 static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
                           ^~~~~~~~~~~~~~~~~~~
fs/dax.c:402:37: warning: passing argument 2 of 'dax_entry_waitqueue' makes pointer from integer without a cast [-Wint-conversion]
   wq = dax_entry_waitqueue(mapping, index, entry, &ewait.key);
                                     ^~~~~
fs/dax.c:152:27: note: expected 'void *' but argument is of type 'long unsigned int'
 static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
                           ^~~~~~~~~~~~~~~~~~~
fs/dax.c:402:8: error: too many arguments to function 'dax_entry_waitqueue'
   wq = dax_entry_waitqueue(mapping, index, entry, &ewait.key);
        ^~~~~~~~~~~~~~~~~~~
fs/dax.c:152:27: note: declared here
 static wait_queue_head_t *dax_entry_waitqueue(struct xa_state *xas,
                           ^~~~~~~~~~~~~~~~~~~
fs/dax.c: In function 'dax_unlock_page':
fs/dax.c:424:2: error: implicit declaration of function 'dax_unlock_mapping_entry'; did you mean 'dax_delete_mapping_entry'? [-Werror=implicit-function-declaration]
  dax_unlock_mapping_entry(mapping, page->index);
  ^~~~~~~~~~~~~~~~~~~~~~~~
  dax_delete_mapping_entry

Caused by commits in the xarray tree interacting with commit

  9b3d53936caa ("filesystem-dax: Introduce dax_lock_page()")

from the nvdimm tree.

Willy thanks for the heads up about this.

I have applied the following merge fix patch (taken from the diff between
the -next tree at this point and the xarray-20180615 branch from the
xarray tree) for today.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 18 Jun 2018 13:17:15 +1000
Subject: [PATCH] filesystem-dax: fixups for xaarray changes

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 fs/dax.c | 75 +++++++++++++++++++++++++-------------------------------
 1 file changed, 34 insertions(+), 41 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 579088945add..91f7bce6ce64 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -350,78 +350,71 @@ static struct page *dax_busy_page(void *entry)
 
 struct page *dax_lock_page(unsigned long pfn)
 {
-	pgoff_t index;
-	struct inode *inode;
-	wait_queue_head_t *wq;
-	void *entry = NULL, **slot;
+	struct page *page = pfn_to_page(pfn);
+	XA_STATE(xas, NULL, 0);
+	void *entry;
 	struct address_space *mapping;
-	struct wait_exceptional_entry_queue ewait;
-	struct page *ret = NULL, *page = pfn_to_page(pfn);
 
-	rcu_read_lock();
 	for (;;) {
+		rcu_read_lock();
 		mapping = READ_ONCE(page->mapping);
 
-		if (!mapping || !IS_DAX(mapping->host))
+		if (!mapping || !IS_DAX(mapping->host)) {
+			page = NULL;
 			break;
+		}
 
 		/*
 		 * In the device-dax case there's no need to lock, a
 		 * struct dev_pagemap pin is sufficient to keep the
 		 * inode alive.
 		 */
-		inode = mapping->host;
-		if (S_ISCHR(inode->i_mode)) {
-			ret = page;
+		if (S_ISCHR(mapping->host->i_mode))
 			break;
-		}
 
-		xa_lock_irq(&mapping->i_pages);
+		xas.xa = &mapping->i_pages;
+		xas_lock_irq(&xas);
+		rcu_read_unlock();
 		if (mapping != page->mapping) {
 			xa_unlock_irq(&mapping->i_pages);
 			continue;
 		}
-		index = page->index;
-
-		init_wait(&ewait.wait);
-		ewait.wait.func = wake_exceptional_entry_func;
-
-		entry = __radix_tree_lookup(&mapping->i_pages, index, NULL,
-				&slot);
-		if (!entry ||
-		    WARN_ON_ONCE(!radix_tree_exceptional_entry(entry))) {
-			xa_unlock_irq(&mapping->i_pages);
-			break;
-		} else if (!slot_locked(mapping, slot)) {
-			lock_slot(mapping, slot);
-			ret = page;
-			xa_unlock_irq(&mapping->i_pages);
-			break;
+		xas_set(&xas, page->index);
+		entry = xas_load(&xas);
+		if (dax_is_locked(entry)) {
+			entry = get_unlocked_entry(&xas);
+			/* Did the page move while we slept? */
+			if (dax_to_pfn(entry) != pfn) {
+				xas_unlock_irq(&xas);
+				continue;
+			}
 		}
-
-		wq = dax_entry_waitqueue(mapping, index, entry, &ewait.key);
-		prepare_to_wait_exclusive(wq, &ewait.wait,
-				TASK_UNINTERRUPTIBLE);
-		xa_unlock_irq(&mapping->i_pages);
-		rcu_read_unlock();
-		schedule();
-		finish_wait(wq, &ewait.wait);
-		rcu_read_lock();
+		dax_lock_entry(&xas, entry);
+		xas_unlock_irq(&xas);
+		goto out;
 	}
 	rcu_read_unlock();
 
+out:
 	return page;
 }
 
 void dax_unlock_page(struct page *page)
 {
 	struct address_space *mapping = page->mapping;
-	struct inode *inode = mapping->host;
+	XA_STATE(xas, &mapping->i_pages, page->index);
+	void *entry;
 
-	if (S_ISCHR(inode->i_mode))
+	if (S_ISCHR(mapping->host->i_mode))
 		return;
 
-	dax_unlock_mapping_entry(mapping, page->index);
+	xas_lock_irq(&xas);
+	entry = xas_load(&xas);
+	BUG_ON(!dax_is_locked(entry));
+	entry = dax_make_page_entry(page, entry);
+	xas_store(&xas, entry);
+	dax_wake_entry(&xas, entry, false);
+	xas_unlock_irq(&xas);
 }
 
 /*
-- 
2.17.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2018-06-18  3:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  3:27 Stephen Rothwell [this message]
2018-06-18 16:50 ` linux-next: build failure after merge of the xarray tree Dan Williams
2018-06-18 17:09   ` Matthew Wilcox
2018-06-27  3:09     ` Stephen Rothwell
2019-02-12  5:20 Stephen Rothwell
2019-02-12 16:15 ` Matthew Wilcox
2019-02-12 16:23   ` Jason Gunthorpe
2019-02-13 21:26     ` Matthew Wilcox
2019-02-13 22:09       ` Jason Gunthorpe
2019-02-21 12:47         ` Stephen Rothwell
2019-02-21 17:40           ` Jason Gunthorpe
2019-02-21  6:13 Stephen Rothwell
2019-02-21 12:34 ` Leon Romanovsky
2019-02-21 12:48   ` Stephen Rothwell
2019-02-21 13:16     ` Leon Romanovsky
2019-02-21 13:23       ` Stephen Rothwell
2019-03-11  2:44   ` Matthew Wilcox
2019-03-11 12:13     ` Jason Gunthorpe
2019-03-11 12:31       ` Matthew Wilcox
2019-03-11 14:12         ` Jason Gunthorpe
2019-03-11 12:46     ` Leon Romanovsky
2020-10-08  6:50 Stephen Rothwell
2020-10-08  6:55 Stephen Rothwell
2020-10-08 14:09 ` Matthew Wilcox

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=20180618132712.4b4eddc9@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=willy@infradead.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).