cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2: Mark flock glock holders as GL_NOPID
Date: Wed,  6 Apr 2022 13:16:43 +0200	[thread overview]
Message-ID: <20220406111643.973001-1-agruenba@redhat.com> (raw)

Add the GL_NOPID flag for flock glock holders.  Clean up the flag
setting code in do_flock.

In add_to_queue(), since flock glock holders now always have the
GL_NOPID flag set, there is no need to separately check for those types
of locks anymore.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/file.c  | 7 +++++--
 fs/gfs2/glock.c | 2 --
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 22b41acfbbc3..6f57a132ef26 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1469,7 +1469,9 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	int sleeptime;
 
 	state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
-	flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT;
+	flags = GL_EXACT | GL_NOPID;
+	if (!IS_SETLKW(cmd))
+		flags |= LM_FLAG_TRY_1CB;
 
 	mutex_lock(&fp->f_fl_mutex);
 
@@ -1495,7 +1497,8 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		error = gfs2_glock_nq(fl_gh);
 		if (error != GLR_TRYFAILED)
 			break;
-		fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT;
+		fl_gh->gh_flags &= ~LM_FLAG_TRY_1CB;
+		fl_gh->gh_flags |= LM_FLAG_TRY;
 		msleep(sleeptime);
 	}
 	if (error) {
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 106a994b20c0..26169cedcefc 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1508,8 +1508,6 @@ __acquires(&gl->gl_lockref.lock)
 	list_for_each_entry(gh2, &gl->gl_holders, gh_list) {
 		if (likely(gh2->gh_owner_pid != gh->gh_owner_pid))
 			continue;
-		if (gh->gh_gl->gl_ops->go_type == LM_TYPE_FLOCK)
-			continue;
 		if (test_bit(HIF_MAY_DEMOTE, &gh2->gh_iflags))
 			continue;
 		if (!pid_is_meaningful(gh2))
-- 
2.35.1


                 reply	other threads:[~2022-04-06 11:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220406111643.973001-1-agruenba@redhat.com \
    --to=agruenba@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).