Cluster-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel DeFreez <dcdefreez@ucdavis.edu>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] GFS2: Always call gfs2_holder_uninit after gfs_holder_init?
Date: Thu, 14 Apr 2016 18:44:38 -0700	[thread overview]
Message-ID: <20160415014438.GB24605@ceres> (raw)

Hi,

I am trying to understand some of the internals of glocks. It looks like the
basic pattern is:

1. Initialize a holder with gfs2_holder_init
2. Enqueue this holder onto the glock
3. Dequeue the holder
4. Uninitialize the holder with gfs2_holder_uninit

My question is this: are there situations where the holder structure does not
need to be uninitialized?  I ask because I have run across a couple of
cases where it is not, such as in gfs2_get_flags:

gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
error = gfs2_glock_nq(&gh);
if (error)
    return error;
...
gfs2_glock_dq(&gh);
gfs2_holder_uninit(&gh);

Is this correct? Here gh is initialized but never uninitialized on the error
path. It seems like this would cause an inaccurate lockref count. In
many other cases the holder structure is uninitialized, even if lock
acquisition fails.

Thanks,

Daniel



             reply	other threads:[~2016-04-15  1:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  1:44 Daniel DeFreez [this message]
2016-04-15 14:30 ` [Cluster-devel] GFS2: Always call gfs2_holder_uninit after gfs_holder_init? Bob Peterson
2016-04-15 20:30   ` Daniel DeFreez

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=20160415014438.GB24605@ceres \
    --to=dcdefreez@ucdavis.edu \
    /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