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 <agrue...@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