linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: "Jérôme Poulin" <jeromepoulin@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Out of memory condition
Date: Wed, 3 Oct 2012 16:52:47 -0400	[thread overview]
Message-ID: <20121003205247.GO2370@localhost.localdomain> (raw)
In-Reply-To: <CALJXSJoKW=7ev8obh3d_XYux0JjwJ+bVAwj_ps7Eih9eYxOQ3w@mail.gmail.com>

On Wed, Oct 03, 2012 at 08:25:11AM -0600, Jérôme Poulin wrote:
> I don't know how to diagnose the problem, but now it is the second
> time. After starting a VM in VirtualBox and filling the memory, Chrome
> stopped loading any pages. After logging out and on, it still wasn't
> working, reboot fixed it.
> 
> This time, I've had the same problem and took the backtrace. Chrome
> starts but doesn't load any pages, I guess it is stuck reading a file
> as many chrome process are in state 'Ds' but are still killable,
> Chrome seems really hard to strace bu anyway strace freezes in D state
> too when attached to a running process.
> 
> The whole filesystem is BTRFS.
> 

Can you give this a try please?  Thanks,

Josef

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 43d1c5a..36eb5f2 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -577,6 +577,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 	u64 em_start;
 	struct extent_map *em;
 	int ret = -ENOMEM;
+	int faili = 0;
 	u32 *sums;
 
 	tree = &BTRFS_I(inode)->io_tree;
@@ -626,8 +627,11 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 	for (pg_index = 0; pg_index < nr_pages; pg_index++) {
 		cb->compressed_pages[pg_index] = alloc_page(GFP_NOFS |
 							      __GFP_HIGHMEM);
-		if (!cb->compressed_pages[pg_index])
+		if (!cb->compressed_pages[pg_index]) {
+			faili = pg_index - 1;
+			ret = -ENOMEM;
 			goto fail2;
+		}
 	}
 	cb->nr_pages = nr_pages;
 
@@ -713,8 +717,10 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 	return 0;
 
 fail2:
-	for (pg_index = 0; pg_index < nr_pages; pg_index++)
-		free_page((unsigned long)cb->compressed_pages[pg_index]);
+	while (faili >= 0) {
+		__free_page(cb->compressed_pages[pg_index]);
+		faili--;
+	}
 
 	kfree(cb->compressed_pages);
 fail1:

  reply	other threads:[~2012-10-03 20:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CALJXSJrtf7wid5xS4H5+E6ws_SjcgjB48ppoU_9+24JSkggKUw@mail.gmail.com>
2012-10-03 14:25 ` Out of memory condition Jérôme Poulin
2012-10-03 20:52   ` Josef Bacik [this message]
2012-10-05 17:20     ` Jérôme Poulin
2012-10-05 17:43       ` Josef Bacik
2012-10-05 20:23         ` Jérôme Poulin
2012-10-05 20:44           ` Josef Bacik
2012-10-09 12:34             ` Jérôme Poulin

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=20121003205247.GO2370@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=jeromepoulin@gmail.com \
    --cc=linux-btrfs@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).