Skip to contentSkip to conversation

cifs: drop the incorrect assertion in cifs_swap_rw()

PATCH Applied Barry Song 3 participants 5 messages Jun 18, 2024 – Jun 20, 2024

Subsystems (6)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v2 1/1 cifs: drop the incorrect assertion in cifs_swap_rw()

From: Barry Song <[email protected]>

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")
Cc NeilBrown <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Steve French <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Chuanhua Han <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Chris Li <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Paulo Alcantara <[email protected]>
Cc Ronnie Sahlberg <[email protected]>
Cc Shyam Prasad N <[email protected]>
Cc Tom Talpey <[email protected]>
Cc Bharath SM <[email protected]>

---
-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(-)
fs/smb/client/file.c +0 -2
index 9d5c2440abfc..1e269e0bc75b 100644
@@ -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
Signature · 1 line
2.34.1
#1 lore raw

tentatively merged into cifs-2.6.git for-next pending testing and any additional review

Quoted 58 lines · Barry Song

From: Barry Song <[email protected]>

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")

Closes:
https://lore.kernel.org/linux-mm/[email protected]/

Cc NeilBrown <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Steve French <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Chuanhua Han <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Chris Li <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Paulo Alcantara <[email protected]>
Cc Ronnie Sahlberg <[email protected]>
Cc Shyam Prasad N <[email protected]>
Cc Tom Talpey <[email protected]>
Cc Bharath SM <[email protected]>

---
-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(-)
fs/smb/client/file.c +0 -2
index 9d5c2440abfc..1e269e0bc75b 100644
@@ -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
--
2.34.1

Signature · 3 lines
Thanks,

Steve
author
#2 lore raw
Quoted 2 lines · Steve French

tentatively merged into cifs-2.6.git for-next pending testing and any additional review

Steve, Thanks! I guess you missed an email from mm-commits.

A couple of hours ago, this was pulled into mm-hotfixes-unstable, likely for the same purpose. Will this cause any conflicts when both changes hit linux-next?

https://lore.kernel.org/mm-commits/[email protected]/

Will we just keep one?

Quoted 63 lines · Barry Song
Quoted 52 lines

From: Barry Song <[email protected]>

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")
Cc NeilBrown <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Steve French <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Chuanhua Han <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Chris Li <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Paulo Alcantara <[email protected]>
Cc Ronnie Sahlberg <[email protected]>
Cc Shyam Prasad N <[email protected]>
Cc Tom Talpey <[email protected]>
Cc Bharath SM <[email protected]>

---
-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(-)
fs/smb/client/file.c +0 -3
index 9d5c2440abfc..1e269e0bc75b 100644
@@ -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
--
Quoted 3 lines

2.34.1

--
Thanks,

Steve

maintainer
#3 lore raw
Quoted 6 lines · On Wed, 19 Jun 2024 16:44:15 +1200 Barry Song <[email protected]> wrote:
Quoted 2 lines · Steve French

tentatively merged into cifs-2.6.git for-next pending testing and any additional review

Steve, Thanks! I guess you missed an email from mm-commits.

Quoted 7 lines

A couple of hours ago, this was pulled into mm-hotfixes-unstable, likely for the same purpose. Will this cause any conflicts when both changes hit linux-next?

https://lore.kernel.org/mm-commits/[email protected]/

Will we just keep one?

Either is OK, but I suggest a 6.10-rcX merge while retaining the cc:stable.

#4 lore raw
Quoted 14 lines · Andrew Morton
Quoted 3 lines · On Wed, 19 Jun 2024 16:44:15 +1200 Barry Song <[email protected]> wrote:
Quoted 2 lines · Steve French

tentatively merged into cifs-2.6.git for-next pending testing and any

additional review

Quoted 8 lines

Steve, Thanks! I guess you missed an email from mm-commits.

A couple of hours ago, this was pulled into mm-hotfixes-unstable, likely for the same purpose. Will this cause any conflicts when both changes hit linux-next?

Quoted 6 lines

https://lore.kernel.org/mm-commits/[email protected]/

Quoted 2 lines

Will we just keep one?

Either is OK, but I suggest a 6.10-rcX merge while retaining the cc:stable.

I have at least two cifs.ko patches to submit in a few days upstream, so am fine with submitting the patch if it tests out ok tomorrow.

git.samba.org - sfrench/cifs-2.6.git/commit
<https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=29433a17a79caa8680b9c0761f2b10502fda9ce3>

Signature · 3 lines
Thanks,

Steve