Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp986804imu; Fri, 11 Jan 2019 12:46:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN41ETdGBbvBP0dfP46O2FYYsHwO0wuHKn32dIzbiuG0i1KjJxGMh0WNDN2EMMeSyq4KwFoi X-Received: by 2002:a65:584e:: with SMTP id s14mr14736755pgr.142.1547239562158; Fri, 11 Jan 2019 12:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547239562; cv=none; d=google.com; s=arc-20160816; b=OiR6sgMVavdm6BdCOe0VJbJ6IknGXavgNmfteQ7uvshEkIGm1lENZZfSonoipQKPQQ xbdtXLqFYEvStlRUU0x9fVvXRTwWQYWvccLpQQ8twitAQbJuOTw1g4fyPrI+3HhqEkKg ugZ5uEuui0GaQ55Ck5VNdQ1B5iSICPpuwqtiXuSqq32lsiBSsY6lZksnt3mcGptQxjsR zVgzMjjrzBf5Kde1dVWgqndjcLLbXD63s2aCwGkrUAQLJIZODzoo9npwdPML3uVv1ZB/ TlFBfMJGSMkPSuDwQfE3ypxhlDI5L/UqNdaOTTApDmfgg+Pc0VG873t0RGnPagvdmpn1 esVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MAM/ooZ4JY0qjVFAmA6OtvhxGd1FxWEHXXzAR+3RtpM=; b=qbXcAkOdkz3VQ22MVgu8rtc3eiWvxJovbnOD+Ldx/vKy9ieywjPGSxAot4MdPFNJRi b3h82qp/fvKMFrMJhlcdkZ+iD2GctuQx7Gdf7BCZ5046cKf8TZIsl9sMsA4Xbl1rlcdb 7JMY31tWOqO0MN8FAl6+sT9huDZaiTonz/Q29B955Ipf0YfRO0xy5MnumfP3KWo41L6/ uiWV0KUPvM9kFA7+GAZykW7aP+BD0NOUuoAB38CnJElay+Bo5ZlJG99CHLQENrKXr11d qpzFmm1vmwbRi0+94AYjhm/2jGSgkbqLP1G4cuqj+WIPebdGIL09JrAdIbtrspy7xD0D UySw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nf0oZRKZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si21713797pls.170.2019.01.11.12.45.46; Fri, 11 Jan 2019 12:46:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nf0oZRKZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404648AbfAKOod (ORCPT + 99 others); Fri, 11 Jan 2019 09:44:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:37432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390045AbfAKOo3 (ORCPT ); Fri, 11 Jan 2019 09:44:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0F7B206B6; Fri, 11 Jan 2019 14:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217868; bh=grEBYRVM6RwhhVZLqXFHbll7TMPH7t7XJL+avMDBCPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nf0oZRKZetYNAZjc/5FfQCy60QpZJfwcXh4X7q29q2ds2eo2rIsY6WwL0h5dUK/Y4 z/9KZJCdjSRrP0ChDWxczbmpxa2J3QyEgP25p6VL1LUHlHymeI0iK6hf0RIlOcddcR ymY94eScrkBN42eOaN28/c+4bVlbfeoQ6TgXcEZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Coddington , "J. Bruce Fields" Subject: [PATCH 4.20 38/65] lockd: Show pid of lockd for remote locks Date: Fri, 11 Jan 2019 15:15:24 +0100 Message-Id: <20190111131101.839152665@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Coddington commit b8eee0e90f9797b747113638bc75e739b192ad38 upstream. Commit 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks") specified that the l_pid returned for F_GETLK on a local file that has a remote lock should be the pid of the lock manager process. That commit, while updating other filesystems, failed to update lockd, such that locks created by lockd had their fl_pid set to that of the remote process holding the lock. Fix that here to be the pid of lockd. Also, fix the client case so that the returned lock pid is negative, which indicates a remote lock on a remote file. Fixes: 9d5b86ac13c5 ("fs/locks: Remove fl_nspid and use fs-specific...") Cc: stable@vger.kernel.org Signed-off-by: Benjamin Coddington Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/lockd/clntproc.c | 2 +- fs/lockd/xdr.c | 4 ++-- fs/lockd/xdr4.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -442,7 +442,7 @@ nlmclnt_test(struct nlm_rqst *req, struc fl->fl_start = req->a_res.lock.fl.fl_start; fl->fl_end = req->a_res.lock.fl.fl_end; fl->fl_type = req->a_res.lock.fl.fl_type; - fl->fl_pid = 0; + fl->fl_pid = -req->a_res.lock.fl.fl_pid; break; default: status = nlm_stat_to_errno(req->a_res.status); --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c @@ -127,7 +127,7 @@ nlm_decode_lock(__be32 *p, struct nlm_lo locks_init_lock(fl); fl->fl_owner = current->files; - fl->fl_pid = (pid_t)lock->svid; + fl->fl_pid = current->tgid; fl->fl_flags = FL_POSIX; fl->fl_type = F_RDLCK; /* as good as anything else */ start = ntohl(*p++); @@ -269,7 +269,7 @@ nlmsvc_decode_shareargs(struct svc_rqst memset(lock, 0, sizeof(*lock)); locks_init_lock(&lock->fl); lock->svid = ~(u32) 0; - lock->fl.fl_pid = (pid_t)lock->svid; + lock->fl.fl_pid = current->tgid; if (!(p = nlm_decode_cookie(p, &argp->cookie)) || !(p = xdr_decode_string_inplace(p, &lock->caller, --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c @@ -119,7 +119,7 @@ nlm4_decode_lock(__be32 *p, struct nlm_l locks_init_lock(fl); fl->fl_owner = current->files; - fl->fl_pid = (pid_t)lock->svid; + fl->fl_pid = current->tgid; fl->fl_flags = FL_POSIX; fl->fl_type = F_RDLCK; /* as good as anything else */ p = xdr_decode_hyper(p, &start); @@ -266,7 +266,7 @@ nlm4svc_decode_shareargs(struct svc_rqst memset(lock, 0, sizeof(*lock)); locks_init_lock(&lock->fl); lock->svid = ~(u32) 0; - lock->fl.fl_pid = (pid_t)lock->svid; + lock->fl.fl_pid = current->tgid; if (!(p = nlm4_decode_cookie(p, &argp->cookie)) || !(p = xdr_decode_string_inplace(p, &lock->caller,