[PATCH] cifs: Fix up netfs-writeback vs cifs fixes merge conflicts

David Howells posted 1 patch 2 months, 2 weeks ago
fs/smb/client/cifssmb.c |   14 +++++++-------
fs/smb/client/smb2pdu.c |    2 --
2 files changed, 7 insertions(+), 9 deletions(-)
[PATCH] cifs: Fix up netfs-writeback vs cifs fixes merge conflicts
Posted by David Howells 2 months, 2 weeks ago
    
Fix up the conflicts between the netfslib development patches and cifs fix
commits due to:

        a68c74865f517e26728735aba0ae05055eaff76c
        cifs: Fix SMB1 readv/writev callback in the same way as SMB2/3

conflicting with:

        ee4cdf7ba857
        netfs: Speed up buffered reading"

This will need to be applied if/when Christian's vfs.netfs branch is merged.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <stfrench@microsoft.com>
cc: Paulo Alcantara <pc@manguebit.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
---
 fs/smb/client/cifssmb.c |   14 +++++++-------
 fs/smb/client/smb2pdu.c |    2 --
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 6ad22732c25c..d0df0c17b18f 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -1266,9 +1266,7 @@ static void cifs_readv_worker(struct work_struct *work)
 	struct cifs_io_subrequest *rdata =
 		container_of(work, struct cifs_io_subrequest, subreq.work);
 
-	netfs_subreq_terminated(&rdata->subreq,
-				(rdata->result == 0 || rdata->result == -EAGAIN) ?
-				rdata->got_bytes : rdata->result, true);
+	netfs_read_subreq_terminated(&rdata->subreq, rdata->result, false);
 }
 
 static void
@@ -1327,9 +1325,9 @@ cifs_readv_callback(struct mid_q_entry *mid)
 		__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
 		rdata->result = 0;
 	} else {
-		if (rdata->got_bytes < rdata->actual_len &&
-		    rdata->subreq.start + rdata->subreq.transferred + rdata->got_bytes ==
-		    ictx->remote_i_size) {
+		size_t trans = rdata->subreq.transferred + rdata->got_bytes;
+		if (trans < rdata->subreq.len &&
+		    rdata->subreq.start + trans == ictx->remote_i_size) {
 			__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
 			rdata->result = 0;
 		}
@@ -1337,7 +1335,9 @@ cifs_readv_callback(struct mid_q_entry *mid)
 
 	rdata->credits.value = 0;
 	rdata->subreq.transferred += rdata->got_bytes;
-	netfs_read_subreq_terminated(&rdata->subreq, rdata->result, false);
+	trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress);
+	INIT_WORK(&rdata->subreq.work, cifs_readv_worker);
+	queue_work(cifsiod_wq, &rdata->subreq.work);
 	release_mid(mid);
 	add_credits(server, &credits, 0);
 }
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 95377bb91950..bb8ecbbe78af 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -4614,8 +4614,6 @@ smb2_readv_callback(struct mid_q_entry *mid)
 			      0, cifs_trace_rw_credits_read_response_clear);
 	rdata->credits.value = 0;
 	rdata->subreq.transferred += rdata->got_bytes;
-	if (rdata->subreq.start + rdata->subreq.transferred >= rdata->subreq.rreq->i_size)
-		__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
 	trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress);
 	INIT_WORK(&rdata->subreq.work, smb2_readv_worker);
 	queue_work(cifsiod_wq, &rdata->subreq.work);