From patchwork Tue Jun 18 07:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13701875 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 E4796C27C4F for ; Tue, 18 Jun 2024 07:23:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 312538D001A; Tue, 18 Jun 2024 03:23:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C1EE8D0001; Tue, 18 Jun 2024 03:23:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 162A88D001A; Tue, 18 Jun 2024 03:23:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E9A758D0001 for ; Tue, 18 Jun 2024 03:23:23 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9378F1C1033 for ; Tue, 18 Jun 2024 07:23:23 +0000 (UTC) X-FDA: 82243168686.11.A93D02E Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf09.hostedemail.com (Postfix) with ESMTP id CEFAD140014 for ; Tue, 18 Jun 2024 07:23:19 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=I3kc1XSq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718695394; a=rsa-sha256; cv=none; b=ex/OcS8sNtBVXhH4bbDv85I6Q0luXMsP4gabYVswdMSz9eC7Gl1DaUF1G0wK51aq80Icz3 9S5MrO4lbgX7N38bu7x+3sp3MSJ0L6UtTM383xEPQqlB18Q0wKz6lKdzuGfqLh9zboUELY CTFpeCLAzXDWX/+o3MjkdpozQNH7cdg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=I3kc1XSq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718695394; 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:references:dkim-signature; bh=n7p6iRUSW5XVR70B17ZTO0vLEn0KFEfKaxRI0vxTAiM=; b=jjQhb9O0Sz8kbtH7HhNCldXI9WdRMbPlyzDNHHBM1POH0skevFwARe/iQGzmZuHHsFbDmZ wnyn5Y1SdSUwYUHQHLMHdIHwZd4Xmq9Xn/KnolpsvhSdKoQjCNrtzeKNyIZKZYrmWZ+drV 8tbwyf8K+e5AeGs0JcqSkyISIn7gVoc= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-705e9e193caso2088017b3a.2 for ; Tue, 18 Jun 2024 00:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718695398; x=1719300198; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n7p6iRUSW5XVR70B17ZTO0vLEn0KFEfKaxRI0vxTAiM=; b=I3kc1XSqkMLqgf3jI0y0Ydyehv000tUKf0gpeB4GwTA+91H9wIVMoNKDLVXi+uzYUE DAUrdN7fN4FfaxfdxAzD9mU2PHXsln7oD3775Qe62djt3rTXfoH8pmyZfP1TTqUAlWMy 3JyITn3EeoAGzAIR9wY0SHQ2wVrvmaVtnZ7sfk0E2Rs7M5MSWh1GW+IwAns6TETiJxWW 0Bq/QjqrqQ3SEwagLcPBOm+A0+iOF742Iv5J322A10qlbYHmS0e+Yb0Taiw1LXOnpAdV RRN+tljLWPMOpaw0mAlSJGwMGVP/PX10BRTwgFy5HdSmk7+So8X6rULkVvmmDrQTM1tZ jGig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718695398; x=1719300198; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n7p6iRUSW5XVR70B17ZTO0vLEn0KFEfKaxRI0vxTAiM=; b=i9oBBHXcDJ+xd4ANo1Ow6setEZyX3zP2soZLhMsJQZM0nsu/fkv7vRAdaFUAeL0ldK F67BRq8sTKuTu/wHZ/EQ/KnNh/XCNZIOPm4q5ow4ZjdxYwmhZYgSFAFGstT5GP3grDew tCOTi12dZ+GGI4BfigB5c27Rsf1vGJXcOOJnfmUtCy/oVmGm82cOZyuOoNcUt2+6Z51G s2nf3saqUxHuVw5YOf4YK4BAGWHJW6HZlq3zwGkTtMW3Kw9oRYk+/UO1oCXZEfXQGwly /MPPI2u+25oTCZSrnFUwvvwtWb51pc2ECMiPszo2YKpMriNGP0BSCgVy7XNPVhrQIlZo gt6A== X-Forwarded-Encrypted: i=1; AJvYcCXmeS49CXdtoLLTJbrPNowOjjNm44cNxzKkGxlw3732HOryEtr6ohhzYymHyX+3FedzKaco9PEULvU8ZBA3NH5Xd0M= X-Gm-Message-State: AOJu0Yzd1RX+nLJPgvcp2nLyTclDtbRVqpYMk5KsojpxFS9RUNgG/Nq/ CA1ZvQ9BfsKp0GQ/1xs6cW1zi5Tav5sHQxsfoEYA78wRa3yNYEK0 X-Google-Smtp-Source: AGHT+IGLgq7HqLryiT2SHaAY/eKo2T49wUObwJ5Wedf9z2+YS6ZtJtX6QZyW4RjJ+hSMRnucE8IAoA== X-Received: by 2002:aa7:88cd:0:b0:705:befb:fcd2 with SMTP id d2e1a72fcca58-705d71b105fmr13944511b3a.33.1718695398519; Tue, 18 Jun 2024 00:23:18 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb4aa4fsm8396536b3a.131.2024.06.18.00.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 00:23:18 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-cifs@vger.kernel.org, linux-mm@kvack.org, sfrench@samba.org Cc: anna@kernel.org, chrisl@kernel.org, hanchuanhua@oppo.com, hch@lst.de, jlayton@kernel.org, linux-nfs@vger.kernel.org, neilb@suse.de, ryan.roberts@arm.com, stable@vger.kernel.org, trondmy@kernel.org, v-songbaohua@oppo.com, ying.huang@intel.com, Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM Subject: [PATCH v2] cifs: drop the incorrect assertion in cifs_swap_rw() Date: Tue, 18 Jun 2024 19:22:58 +1200 Message-Id: <20240618072258.33128-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CEFAD140014 X-Stat-Signature: hi389ot3dt7q645a8kwqgz9ba6j47jbs X-Rspam-User: X-HE-Tag: 1718695399-269310 X-HE-Meta: U2FsdGVkX1+7pABTUpVzNoM7P4x+a0HeoRcdV1+kJx9QueA3+gIRwI37RM4OX33TzG4eZshYNAO+x2MrVxjwyNKhaRQcqtfE6W/jme84OY9T9CdbSYlBkayCp1Kfy6cHxWux2GQkkAsq6/oIGg3/C85lppD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8jL5MplJB/9tTui34EgkBO8j4wPKhCIqZ4CWqDhaLFGqteorA+IyjvxLwpvRUBaqPKhR864guchWWY9WlqwHMIgt0lp23oG+uGtFyRY2n0Sf4KZMQaedgMZ0kzzUpPH6lAfwj17gmTUWKU5D3LJMQ3IDj0Nz00t2j/4F3V2nkEkP1yRoFVLWtG5DDvPXNn9u0SH9/kXcotSrXNJzwkFVwdJYDh21hq+ynTR1rr907fGrJnpNztROYamIF0ws9OUiGa7PcWhZao/vjDSTERPTrAxQpp4I/B1nxDKfRxH6fzustbo8rqJ3ecV8G6tUSa3BG4WSF2tHpmId0zO9cEVIa5C9QKP0RiYgxGlsQgh5WbUjRAftgRjORbxrXlQsi/0giY3bAY2rr0vg9A07+QLACM8rSFFuicOYKCq1zpkr+tFs88rWETE147CIlb4t9qqZmvXkf9oNEPEdRDBfJVFO/7aRarW0Daj2bzZ6tr+hexRMpinrWSEf6MdGFXKHnMOYG8zOdO3W1YGiY0ra7BuXMcYAeEFyJp2iNKp39/EoPNLksf8YinUkQ== 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: From: Barry Song Since commit 2282679fb20b ("mm: submit multipage write for SWP_FS_OPS swap-space"), we can plug multiple pages then unplug them all together. That means iov_iter_count(iter) could be way bigger than PAGE_SIZE, it actually equals the size of iov_iter_npages(iter, INT_MAX). Note this issue has nothing to do with large folios as we don't support THP_SWPOUT to non-block devices. Fixes: 2282679fb20b ("mm: submit multipage write for SWP_FS_OPS swap-space") Reported-by: Christoph Hellwig Closes: https://lore.kernel.org/linux-mm/20240614100329.1203579-1-hch@lst.de/ Cc: NeilBrown Cc: Anna Schumaker Cc: Steve French Cc: Trond Myklebust Cc: Chuanhua Han Cc: Ryan Roberts Cc: Chris Li Cc: "Huang, Ying" Cc: Jeff Layton Cc: Paulo Alcantara Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Tom Talpey Cc: Bharath SM Cc: Signed-off-by: Barry Song --- -v2: * drop the assertion instead of fixing the assertion. per the comments of Willy, Christoph in nfs thread. fs/smb/client/file.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 9d5c2440abfc..1e269e0bc75b 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -3200,8 +3200,6 @@ static int cifs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) { ssize_t ret; - WARN_ON_ONCE(iov_iter_count(iter) != PAGE_SIZE); - if (iov_iter_rw(iter) == READ) ret = netfs_unbuffered_read_iter_locked(iocb, iter); else