cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: Mark flock glock holders as GL_NOPID
@ 2022-04-06 11:16 Andreas Gruenbacher
  0 siblings, 0 replies; only message in thread
From: Andreas Gruenbacher @ 2022-04-06 11:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-06 11:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06 11:16 [Cluster-devel] [PATCH] gfs2: Mark flock glock holders as GL_NOPID Andreas Gruenbacher

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).