From patchwork Tue Jun 18 06:56:47 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: 13701846 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 5A8BFC27C4F for ; Tue, 18 Jun 2024 06:57:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E49928D0018; Tue, 18 Jun 2024 02:57:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF92F8D0001; Tue, 18 Jun 2024 02:57:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC1798D0018; Tue, 18 Jun 2024 02:57:10 -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 AE7C48D0001 for ; Tue, 18 Jun 2024 02:57:10 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6B9478037A for ; Tue, 18 Jun 2024 06:57:10 +0000 (UTC) X-FDA: 82243102620.28.E8C40B6 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf28.hostedemail.com (Postfix) with ESMTP id A04AFC0005 for ; Tue, 18 Jun 2024 06:57:08 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=FDKLj3Hf; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718693822; 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=KmF6KPc9+GZruNyUDMjMgjUoCjmX7IHTZKqjKvSeh3Q=; b=H4OWO0YUWmnVWK3vV0oQKRNO+Zo4jRlFHhXPy3Tx4wsz923epy9jP1dzBvkEf8od8fJhoU wj5XPPuGtfRBlA3pC+TxRTILIxhK2Getw7/pY+VNWq6bGKATZj928aDF2BkNFY/eWsyKvi 8v0q6vhixNiOyheDq+gezDrzVnx93dI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718693822; a=rsa-sha256; cv=none; b=ZTOr2x3mowwpR+c9bPISIOo3FOaNyRcX0SB8v5QRE7GcmbxfMu4BzydwJVagrKZZLH0kqE 1h30DaH614+K2bJVMqq1B8/lXY5KubaDDl0b4/WqvMtkSTkkmMQziaoqZk+iID2RmIbGXl AfNTZ3ZozMTE+hhpFVL6HaVppgeA9+8= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=FDKLj3Hf; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f480624d10so42051055ad.1 for ; Mon, 17 Jun 2024 23:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718693827; x=1719298627; 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=KmF6KPc9+GZruNyUDMjMgjUoCjmX7IHTZKqjKvSeh3Q=; b=FDKLj3HfKk60Lu1mL3M/ZXW6oQzDP9Ozx8SkMTjjGyE8V+B6+UE7ozuEqNTqtWbrkE y06vYv+aY7IHBLssks2R1qMR15yDhbBhI+KpJcR1hzhVb6s+hnYoozXa7sNX/OGZ2/ox /3XZYwfle7zt4gpNAqLrbd0egb3XETf6+kO5WTxu5qfK7dlrys/Z+rimNVD6t9jlrL9e 8Vl1of9iaQQsL7rmtPwfXz30AqHhTFQ7wr8SoD6W2xjXYAyPMJy6kWgQ4nLSvGt2U5pZ trI9gt66xR/rDlqukNEZPGQMF+8LPzTN90JxYwnRHoRB4L+x1Gcw/bsp3BaRss/De1Qg XtUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718693827; x=1719298627; 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=KmF6KPc9+GZruNyUDMjMgjUoCjmX7IHTZKqjKvSeh3Q=; b=i7nRi+ehSRMN/tX0s6yU6yhCUKqXwE2gRooQRJ0AmJUfSt86ApCEND8EcPzYathXQW iAtfww7GNgNwFC8rNoG3I8o5mLMCMfp7joJtgv2lSEBQZwng9/5rTybbklax1eTGfMbA nntDCu6LuxHkUreqowMxmDfskwpa38jFirUhM5XPd+nJGsKzAROwht+n+lkTdk1wLexI AvtDMZ4ibS14PFHhgCp9grpJ8R/clJFi2jbYwBeTI5vn49ItSl35Po4mQih9ZpNy/+nY N/hMO7Mg2Ln7NKDBkX8K+MWpOuUaBhaRW7NBiZtwudBdf5cwrT/WgJ0mrpxB7IyB6gjx mtmg== X-Forwarded-Encrypted: i=1; AJvYcCWEOJktCcPREL9PxNy1bcmQ/m3qTuB1mU4gZfbNN0Q7dI1UqIEFpqxxCAjw6XeEbfuOJepPNJu/U07TR70vaUU2iUk= X-Gm-Message-State: AOJu0Yyhho98RxEErjwoYD+BVluk3Kp1PCqZ1MYAFzvN64c04yePCAFF 77rGgXkdDG5ZptOyHrQ9toiyupBOR8E9mjYxmGBsJrIocf8SmQG2 X-Google-Smtp-Source: AGHT+IHMal/AokP8mwiRaq7bZ9i72VrxZV0AeSOZR7Q0WLxVY4/dev/bAUoih6DePWgeyRaz3HVOZQ== X-Received: by 2002:a17:902:f682:b0:1f7:1ba3:b91c with SMTP id d9443c01a7336-1f8625c0724mr165605715ad.1.1718693827416; Mon, 17 Jun 2024 23:57:07 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855e80ef6sm90156395ad.115.2024.06.17.23.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 23:57:07 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Cc: anna@kernel.org, chrisl@kernel.org, hanchuanhua@oppo.com, hch@lst.de, jlayton@kernel.org, linux-cifs@vger.kernel.org, neilb@suse.de, ryan.roberts@arm.com, sfrench@samba.org, stable@vger.kernel.org, trondmy@kernel.org, v-songbaohua@oppo.com, ying.huang@intel.com, Matthew Wilcox , Martin Wege Subject: [PATCH v2] nfs: drop the incorrect assertion in nfs_swap_rw() Date: Tue, 18 Jun 2024 18:56:47 +1200 Message-Id: <20240618065647.21791-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: A04AFC0005 X-Stat-Signature: umzzy64oxf1z6ks8g7k5fm3ghtkmyepo X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718693828-14791 X-HE-Meta: U2FsdGVkX1+x0Bt254oGiH7ZtUXDNBJWOn+MKEr0ycB/kwf1ep3pZC3uRDrmVhGiBve2zcGVL/eI3mIAXTqWPX40aDHXOc7m2a0ABz9PPHNLcT2PBAXEOJrOGsVtrslt4/2uStlH01ca3UwO18VxixnO9AFvt0MxY2eE/EQWUCYU4hip7m+HYjVZWLuhdS1K8LmyCq2FXPTcB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1v5Wsgj/Rs7a570Tzpvqfdr5bhq9aJqpEM/Hstdm1N3Hw2sbJk1eA5YadytfgTFRddi1KUUGoKSiuL3c6Fqj0ghGYtibATzsRzlLwzNvZWD6FZfNhlIpVRlk8nwCDt50wF1+gGVG6lQpIeCmPciheiLCTK66S+9JSzUObkXtJd2ARPvycrYmw9ZshbxLeY1PIa7lCAK14YkVwMk0UF4k5nF7esouiRyaO3qU8uozf2EM46eEjnh/sQM6E4M8toHgH3cyh3EwRddhDczv8EFNJtcVeBnA198V6hMw8pRfmdR6GDPXpS6BAKrQkpNshMO9raUNcifCM/0JB46S267DxeVXopRC1fifbRP7uHgTy9a94ICjGNuUgGeszEXJ8RaZ04fjD9Aqkvr3/+q7dkLnAzo23PAew9qRPQAzp4xwVgQ1zO8mgP+h7MTOqKlziz0Br+boqhW6nNc3kGS1wuazMse84fphHkoo9JiR0scHttyDUPyQJcHb3LPz3Tcy+c+/Rab0o= 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: Christoph Hellwig 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/20240617053201.GA16852@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: Cc: Matthew Wilcox Cc: Martin Wege Signed-off-by: Christoph Hellwig [Barry: figure out the cause and correct the commit message] Signed-off-by: Barry Song Reviewed-by: Martin Wege --- fs/nfs/direct.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index bb2f583eb28b..90079ca134dd 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -141,8 +141,6 @@ int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) { ssize_t ret; - VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); - if (iov_iter_rw(iter) == READ) ret = nfs_file_direct_read(iocb, iter, true); else