From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 1/2] GFS2: Make gfs2_clear_inode() queue the final put
Date: Fri, 20 Nov 2015 13:33:22 +0000 [thread overview]
Message-ID: <564F2122.1040506@redhat.com> (raw)
In-Reply-To: <1447958561-2584-2-git-send-email-rpeterso@redhat.com>
Hi,
On 19/11/15 18:42, Bob Peterson wrote:
> This patch changes function gfs2_clear_inode() so that instead
> of calling gfs2_glock_put directly() most of the time, it queues
> the glock to the delayed work queue. That avoids a possible
> deadlock where it calls dlm during a fence operation:
> dlm waits for a fence operation, the fence operation waits for
> memory, the shrinker waits for gfs2 to free an inode from memory,
> but gfs2 waits for dlm.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> fs/gfs2/glock.c | 34 +++++++++++++++++-----------------
> fs/gfs2/glock.h | 1 +
> fs/gfs2/super.c | 5 ++++-
> 3 files changed, 22 insertions(+), 18 deletions(-)
[snip]
Most of the patch seems to just rename the workqueue which makes it
tricky to spot the other changes. However, the below code seems to be
the new bit..
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index 9d5c3f7..46e5004 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -24,6 +24,7 @@
> #include <linux/crc32.h>
> #include <linux/time.h>
> #include <linux/wait.h>
> +#include <linux/workqueue.h>
> #include <linux/writeback.h>
> #include <linux/backing-dev.h>
> #include <linux/kernel.h>
> @@ -1614,7 +1615,9 @@ out:
> ip->i_gl->gl_object = NULL;
> flush_delayed_work(&ip->i_gl->gl_work);
> gfs2_glock_add_to_lru(ip->i_gl);
> - gfs2_glock_put(ip->i_gl);
> + if (queue_delayed_work(gfs2_glock_workqueue,
> + &ip->i_gl->gl_work, 0) == 0)
> + gfs2_glock_put(ip->i_gl);
> ip->i_gl = NULL;
> if (ip->i_iopen_gh.gh_gl) {
> ip->i_iopen_gh.gh_gl->gl_object = NULL;
which replaces a put with a queue & put if the queue fails (due to it
being already on the queue) which doesn't look quite right to be since
if calling gfs2_glock_put() was not safe before, then calling it
conditionally like this is still no safer I think?
Steve.
next prev parent reply other threads:[~2015-11-20 13:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 18:42 [Cluster-devel] [GFS2 PATCH 0/2] GFS2: Avoid inode shrinker-related deadlocks Bob Peterson
2015-11-19 18:42 ` [Cluster-devel] [GFS2 PATCH 1/2] GFS2: Make gfs2_clear_inode() queue the final put Bob Peterson
2015-11-20 13:33 ` Steven Whitehouse [this message]
2015-11-25 14:22 ` Bob Peterson
2015-11-25 14:26 ` Steven Whitehouse
2015-12-01 15:42 ` Bob Peterson
2015-12-02 10:23 ` Steven Whitehouse
2015-12-02 16:42 ` Bob Peterson
2015-12-02 17:41 ` Bob Peterson
2015-12-03 11:18 ` Steven Whitehouse
2015-12-04 14:51 ` Bob Peterson
2015-12-04 15:51 ` David Teigland
2015-12-04 17:38 ` Bob Peterson
2015-12-08 7:57 ` Dave Chinner
2015-12-08 9:03 ` Steven Whitehouse
2015-11-19 18:42 ` [Cluster-devel] [GFS2 PATCH 2/2] GFS2: Revert 35e478f Flush pending glock work when evicting an inode Bob Peterson
2015-11-20 13:47 ` Steven Whitehouse
2015-11-25 14:36 ` Bob Peterson
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=564F2122.1040506@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).