linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] smb3: Miscellaneous fixes
@ 2023-02-27 13:04 David Howells
  2023-02-27 13:04 ` [PATCH 1/2] cifs: Fix cifs_write_back_from_locked_folio() David Howells
  2023-02-27 13:04 ` [PATCH 2/2] iov: Fix netfs_extract_user_to_sg() David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2023-02-27 13:04 UTC (permalink / raw)
  To: Steve French
  Cc: David Howells, Shyam Prasad N, Rohith Surabattula, Tom Talpey,
	Stefan Metzmacher, Jeff Layton, linux-cifs, linux-kernel

Hi Steve,

Here are a couple more fix patches for you.

David

David Howells (2):
  cifs: Fix cifs_write_back_from_locked_folio()
  iov: Fix netfs_extract_user_to_sg()

 fs/cifs/file.c      | 1 +
 fs/netfs/iterator.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] cifs: Fix cifs_write_back_from_locked_folio()
  2023-02-27 13:04 [PATCH 0/2] smb3: Miscellaneous fixes David Howells
@ 2023-02-27 13:04 ` David Howells
  2023-02-27 13:04 ` [PATCH 2/2] iov: Fix netfs_extract_user_to_sg() David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2023-02-27 13:04 UTC (permalink / raw)
  To: Steve French
  Cc: David Howells, Shyam Prasad N, Rohith Surabattula, Tom Talpey,
	Stefan Metzmacher, Jeff Layton, linux-cifs, linux-kernel,
	Steve French

cifs_write_back_from_locked_folio() should return the number of bytes read,
but returns the result of ->async_writev(), which will be 0 on success.  As
it happens, this doesn't prevent cifs_writepages_region() from working as
it will then examine and ignore the pages that are no longer dirty rather
than just skipping over them.

Fixes: d08089f649a0 ("cifs: Change the I/O paths to use an iterator rather than a page list")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Tom Talpey <tom@talpey.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ebfcaae8c437..f8cc68ce9d8a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2839,6 +2839,7 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,
 	free_xid(xid);
 	if (rc == 0) {
 		wbc->nr_to_write = count;
+		rc = len;
 	} else if (is_retryable_error(rc)) {
 		cifs_pages_write_redirty(inode, start, len);
 	} else {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] iov: Fix netfs_extract_user_to_sg()
  2023-02-27 13:04 [PATCH 0/2] smb3: Miscellaneous fixes David Howells
  2023-02-27 13:04 ` [PATCH 1/2] cifs: Fix cifs_write_back_from_locked_folio() David Howells
@ 2023-02-27 13:04 ` David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2023-02-27 13:04 UTC (permalink / raw)
  To: Steve French
  Cc: David Howells, Shyam Prasad N, Rohith Surabattula, Tom Talpey,
	Stefan Metzmacher, Jeff Layton, linux-cifs, linux-kernel,
	kernel test robot, Dan Carpenter, Steve French, linux-cachefs

Fix the loop check in netfs_extract_user_to_sg() for extraction from
user-backed iterators to do the body if npages > 0, not if npages < 0
(which it can never be).

This isn't currently used by cifs, which only ever extracts data from BVEC,
KVEC and XARRAY iterators at this level, user-backed iterators having being
decanted into BVEC iterators at a higher level to accommodate the work
being done in a kernel thread.

Found by smatch:
	fs/netfs/iterator.c:139 netfs_extract_user_to_sg() warn: unsigned 'npages' is never less than zero.

Fixes: 018584697533 ("netfs: Add a function to extract an iterator into a scatterlist")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/oe-kbuild-all/202302261115.P3TQi1ZO-lkp@intel.com/
---
 fs/netfs/iterator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/netfs/iterator.c b/fs/netfs/iterator.c
index f00d43b8ac0a..e9a45dea748a 100644
--- a/fs/netfs/iterator.c
+++ b/fs/netfs/iterator.c
@@ -134,7 +134,7 @@ static ssize_t netfs_extract_user_to_sg(struct iov_iter *iter,
 		npages = DIV_ROUND_UP(off + len, PAGE_SIZE);
 		sg_max -= npages;
 
-		for (; npages < 0; npages--) {
+		for (; npages > 0; npages--) {
 			struct page *page = *pages;
 			size_t seg = min_t(size_t, PAGE_SIZE - off, len);
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 0/2] smb3: Miscellaneous fixes
@ 2023-02-23  8:15 David Howells
  0 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2023-02-23  8:15 UTC (permalink / raw)
  To: Steve French
  Cc: David Howells, Shyam Prasad N, Rohith Surabattula, Tom Talpey,
	Stefan Metzmacher, Matthew Wilcox, Jeff Layton, linux-cifs,
	linux-kernel

Hi Steve,

Here are a couple of fix patches for you.

I've pushed the patches here also:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-cifs

David

David Howells (2):
  cifs: Add some missing xas_retry() calls
  cifs: Fix an uninitialised variable

 fs/cifs/file.c      | 6 ++++++
 fs/cifs/smbdirect.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-27 13:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 13:04 [PATCH 0/2] smb3: Miscellaneous fixes David Howells
2023-02-27 13:04 ` [PATCH 1/2] cifs: Fix cifs_write_back_from_locked_folio() David Howells
2023-02-27 13:04 ` [PATCH 2/2] iov: Fix netfs_extract_user_to_sg() David Howells
  -- strict thread matches above, loose matches on Subject: below --
2023-02-23  8:15 [PATCH 0/2] smb3: Miscellaneous fixes David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).