From patchwork Thu Jun 20 17:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13705993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529FEC27C79 for ; Thu, 20 Jun 2024 17:33:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA2558D00CA; Thu, 20 Jun 2024 13:33:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C505B8D00AF; Thu, 20 Jun 2024 13:33:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A574E8D00CA; Thu, 20 Jun 2024 13:33:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7F2248D00AF for ; Thu, 20 Jun 2024 13:33:28 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 35D1B1203DF for ; Thu, 20 Jun 2024 17:33:28 +0000 (UTC) X-FDA: 82251963696.25.8C6F7D8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 5DBD8140004 for ; Thu, 20 Jun 2024 17:33:26 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=B9gh5+1K; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718904796; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uX8xcUkGpuu8sXJI7G0aibuVHEQvl2VRr7qcOSjNkD0=; b=a3OFjzblnOcfl5F7gp9B0jgQuB2wLqHG5Dg9rKqsK6b8vfodC/UpDoPx9RekeBWS9dwswi +lL+JRcW34VavHWVusUswtSERtJhchhPOIIkSMkb0+Mplq0PW9VxbnbxjLkJiu1j3J6Yit 7pyOGAq3Yng3kx5GsP+G0q+kE8dRD1g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718904796; a=rsa-sha256; cv=none; b=IPGp+yFD0DV89Hd56wvInu+kmWCUTUyMqWzllZo9XbGN4fjVXZZAcPGuID2Z20HoYmtM7R agHy9nDnAY8xwlpgnuhhzTLZohTD/0X8cyTeZ85L5Sz3ebRKirigOEEAQrIQBDaS0j3ks4 3vw1e3DNRSUt88bx63B8dmujKa03izo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=B9gh5+1K; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718904805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uX8xcUkGpuu8sXJI7G0aibuVHEQvl2VRr7qcOSjNkD0=; b=B9gh5+1KU85aaAL6SOrsPKEtFGzAIdGajDHA4wquUcFSbtgdK/EojfSiFPFTtR08ZvG4dR bplsN3dKOgSSQfK1f72YGryp/djA2Ey7UTI39ilBVhlyn1OI7G6EsxXlN6vEaYuI81r7np 7sqqhMpGo/17BCvZkO89JMzp9TXt5vs= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-5gkrIObUOdmWGIEp57IBsQ-1; Thu, 20 Jun 2024 13:33:22 -0400 X-MC-Unique: 5gkrIObUOdmWGIEp57IBsQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EDA6719560BE; Thu, 20 Jun 2024 17:33:18 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.39.195.156]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 76B5219560AF; Thu, 20 Jun 2024 17:33:12 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French Subject: [PATCH 11/17] cifs: Move the 'pid' from the subreq to the req Date: Thu, 20 Jun 2024 18:31:29 +0100 Message-ID: <20240620173137.610345-12-dhowells@redhat.com> In-Reply-To: <20240620173137.610345-1-dhowells@redhat.com> References: <20240620173137.610345-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Stat-Signature: 879ddeugm1fdfic66x8ut9t4969zdtux X-Rspamd-Queue-Id: 5DBD8140004 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718904806-326303 X-HE-Meta: U2FsdGVkX18Fd2Yx0Pi/pNVuTbNevYR48O4uxG21gctTCMS9opmh/wjkkgrKNswD90KLqulPQp/+LELjysvAdOU9qYUQ+1LXQM0yZ5ZN4mtaTAbBB91Y2alWPZ+TqMN9wm/golPsrhXZgu5uRvhFf5Keigtbyy+1qLpiq6pYN0Xq24/1uNDLlkqjAPJYHmfSbsM0qkCpBOaCMjfO/sZ8Tn6DlWOTF7449By/WH5IprX6+VK7ID0WPt48/57OA5x6ysJCIicOLyjNIWLTzAYqrfBTCZr1tTw9XlYQxCAiorOJyR5duQOQIB5cBbXz995GA7aRRrLPFwMAgZKD4ldHbl1traG8aDdiSuBsXF8QbJao0Nihh3zdAQRr2/KvLTABPj/uJ5lspuuPJRHQMzgWBDHYOfOqtYB1aCSxq5XIfCExXj3TgU3RRQf9QZe/l+buJCkZfAl31zupU+LSZ+K6eUbR6Aqt5Ri7PG1S9bYQObV5CtsGGrQVfsX332ADDuRZU4yvP11uQY4x57mw/tnirt50oE+qF4/VBQg7GJlHmdXDlzBKjN/+ziopeshLfU+LDAQmE5dX96syTaWJ8f6U7LNtD47KP+gii/ieGFol8qqRhi4IK7el1RZSfNEv71DuFpJGBFS9qHb6WGBe/AFQzornoHOVlEwa0iI+McUk4LCdqftD9y/6X9V2vvzQxz8qjV5PODCVDNObEXKYnTdp3+WnqJMBUdkx3kwidYEVQI8wSqmLEWz7ScRaamxtiIk1tQoaqfI2f9GXNkFBZllZNyAvebsCKjRUoSykKysSV86KbaB8j5l2jBiD1szl6uSS7GxuRUy2OlMiTh9qRlLMjUxMzTflyuHS3coixVtmD9V9M4BSz2wsu5y2Ys0PFndHUOZ7dUG2z+Ff3rOsSO0czjUtzM/4HzcwiERxUQzaHkk2zd2uMe7xO797zMfPixNb7A23E+uxaE7KQMJIfGW U/aGSv7Y WM6KpaqcVTRi+NTlTRNJEvaOu4Dnu298D/EMAt4RlsukBpUmev2jrPXtMl/svLOD9iZt2ljuYvgMa9ROeDAGfE51GiqAjJ7sisPq+CjGUxa9uphY/0VbhJibP8oj7u6Bn7BDB5P+o21Ih1JwI1pE1vjPLlOa/5sRFrlhPn68xka6nDXGEze3/7CCAqJk2FKRymuC/lXElMC2A9RhIQyS5TI515GBCK5VxRSw/HkxLkc9lwHxxSWMYGJJCdLb2lXxTfBljRTEg5WbVyNnECcaS/JjzP2ZYdJDWJz0DYDknGCq3XghaqJ0MmskfLV5BISrZ9rsvXdQh04TcKE9WRMsSI6UtEp2oRzoTtjslPJthn8pvwM96UzIRi07ngtX+geNXirE0MdKtPznuY2hy/6CvuJOM/LywM3Dy3zI/KBjDo3CMeu1NN/V/8dmtcAGZyhwqO8BnXRkV5SMiQk2C/MpQvfYHCpdyk/orWepuiNizti/pf1Uw5U0a/k7wV06ZAOQqNLtz+peEKp44m8Rflu1v3gdj2A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Move the reference pid from the cifs_io_subrequest struct to the cifs_io_request struct as it's the same for all subreqs of a particular request. Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/cifsglob.h | 2 +- fs/smb/client/cifssmb.c | 8 ++++---- fs/smb/client/file.c | 10 +++------- fs/smb/client/smb2pdu.c | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index b48d3f5e8889..bbcc552c07be 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -1495,6 +1495,7 @@ struct cifs_io_request { struct netfs_io_request rreq; struct cifsFileInfo *cfile; struct TCP_Server_Info *server; + pid_t pid; }; /* asynchronous read support */ @@ -1505,7 +1506,6 @@ struct cifs_io_subrequest { struct cifs_io_request *req; }; ssize_t got_bytes; - pid_t pid; unsigned int xid; int result; bool have_xid; diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c index 25e9ab947c17..595c4b673707 100644 --- a/fs/smb/client/cifssmb.c +++ b/fs/smb/client/cifssmb.c @@ -1345,8 +1345,8 @@ cifs_async_readv(struct cifs_io_subrequest *rdata) if (rc) return rc; - smb->hdr.Pid = cpu_to_le16((__u16)rdata->pid); - smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->pid >> 16)); + smb->hdr.Pid = cpu_to_le16((__u16)rdata->req->pid); + smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->req->pid >> 16)); smb->AndXCommand = 0xFF; /* none */ smb->Fid = rdata->req->cfile->fid.netfid; @@ -1689,8 +1689,8 @@ cifs_async_writev(struct cifs_io_subrequest *wdata) if (rc) goto async_writev_out; - smb->hdr.Pid = cpu_to_le16((__u16)wdata->pid); - smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16)); + smb->hdr.Pid = cpu_to_le16((__u16)wdata->req->pid); + smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->req->pid >> 16)); smb->AndXCommand = 0xFF; /* none */ smb->Fid = wdata->req->cfile->fid.netfid; diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 16fa1ac1ed2d..45c860f0e7fd 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -178,14 +178,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq); struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq); struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb); - pid_t pid; int rc = 0; - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) - pid = req->cfile->pid; - else - pid = current->tgid; // Ummm... This may be a workqueue - cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n", __func__, rreq->debug_id, subreq->debug_index, rreq->mapping, subreq->transferred, subreq->len); @@ -199,7 +193,6 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) } __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags); - rdata->pid = pid; rc = rdata->server->ops->async_readv(rdata); out: @@ -236,12 +229,15 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file) rreq->rsize = cifs_sb->ctx->rsize; rreq->wsize = cifs_sb->ctx->wsize; + req->pid = current->tgid; // Ummm... This may be a workqueue if (file) { open_file = file->private_data; rreq->netfs_priv = file->private_data; req->cfile = cifsFileInfo_get(open_file); req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) + req->pid = req->cfile->pid; } else if (rreq->origin != NETFS_WRITEBACK) { WARN_ON_ONCE(1); return -EIO; diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index e213cecd5094..2ae2dbb6202b 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4621,7 +4621,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata) io_parms.length = rdata->subreq.len; io_parms.persistent_fid = rdata->req->cfile->fid.persistent_fid; io_parms.volatile_fid = rdata->req->cfile->fid.volatile_fid; - io_parms.pid = rdata->pid; + io_parms.pid = rdata->req->pid; rc = smb2_new_read_req( (void **) &buf, &total_len, &io_parms, rdata, 0, 0); @@ -4873,7 +4873,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) .length = wdata->subreq.len, .persistent_fid = wdata->req->cfile->fid.persistent_fid, .volatile_fid = wdata->req->cfile->fid.volatile_fid, - .pid = wdata->pid, + .pid = wdata->req->pid, }; io_parms = &_io_parms;