cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/8] GFS2: Use GFP_NOFS when allocating glocks
Date: Fri, 18 Jul 2014 11:37:40 +0100	[thread overview]
Message-ID: <1405679865-15728-4-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1405679865-15728-1-git-send-email-swhiteho@redhat.com>

Normally GFP_KERNEL is ok here, but there is now a rarely used code path
relating to deallocation of unlinked inodes (in certain corner cases)
which if hit at times of memory shortage can cause recursion while
trying to free memory.

One solution would be to try and move the gfs2_glock_get() call so
that it is no longer called while another glock is held, but that
doesn't look at all easy, so GFP_NOFS is the best solution for the
time being.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c1e5b12..b703dcc 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -731,14 +731,14 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 		cachep = gfs2_glock_aspace_cachep;
 	else
 		cachep = gfs2_glock_cachep;
-	gl = kmem_cache_alloc(cachep, GFP_KERNEL);
+	gl = kmem_cache_alloc(cachep, GFP_NOFS);
 	if (!gl)
 		return -ENOMEM;
 
 	memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb));
 
 	if (glops->go_flags & GLOF_LVB) {
-		gl->gl_lksb.sb_lvbptr = kzalloc(GFS2_MIN_LVB_SIZE, GFP_KERNEL);
+		gl->gl_lksb.sb_lvbptr = kzalloc(GFS2_MIN_LVB_SIZE, GFP_NOFS);
 		if (!gl->gl_lksb.sb_lvbptr) {
 			kmem_cache_free(cachep, gl);
 			return -ENOMEM;
-- 
1.8.3.1



  parent reply	other threads:[~2014-07-18 10:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 10:37 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 1/8] GFS2: Only wait for demote when last holder is dequeued Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 2/8] GFS2: Fix race in glock lru glock disposal Steven Whitehouse
2014-07-18 10:37 ` Steven Whitehouse [this message]
2014-07-18 10:37 ` [Cluster-devel] [PATCH 4/8] GFS2: replace count*size kzalloc by kcalloc Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 5/8] GFS2: Allow flocks to use normal glock dq rather than dq_wait Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 6/8] GFS2: Allow caching of glocks for flock Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 7/8] GFS2: memcontrol: Spelling s/invlidate/invalidate/ Steven Whitehouse
2014-07-18 10:37 ` [Cluster-devel] [PATCH 8/8] GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes Steven Whitehouse

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=1405679865-15728-4-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.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 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).