LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Long Li <longli@linuxonhyperv.com>
Cc: kbuild-all@01.org, Steve French <sfrench@samba.org>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	Long Li <longli@microsoft.com>
Subject: Re: [PATCH 5/7] cifs: smbd: Protect memory registration using RCU
Date: Tue, 8 May 2018 14:35:56 +0800	[thread overview]
Message-ID: <201805081349.MX5qQDch%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180507222006.20781-5-longli@linuxonhyperv.com>

Hi Long,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on v4.17-rc4 next-20180507]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Long-Li/cifs-smbd-Make-upper-layer-decide-when-to-destroy-the-transport/20180508-110150
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   fs/cifs/smb2pdu.c:110:47: sparse: expression using sizeof(void)
   fs/cifs/smb2pdu.c:681:26: sparse: expression using sizeof(void)
>> fs/cifs/smb2pdu.c:2613:17: sparse: incompatible types in comparison expression (different address spaces)
   fs/cifs/smb2pdu.c:2993:17: sparse: incompatible types in comparison expression (different address spaces)
   fs/cifs/smb2pdu.c:3251:23: sparse: expression using sizeof(void)
   fs/cifs/smb2pdu.c:3251:23: sparse: expression using sizeof(void)
   fs/cifs/smb2pdu.c:3252:23: sparse: expression using sizeof(void)
   fs/cifs/smb2pdu.c:3713:17: sparse: expression using sizeof(void)
   fs/cifs/smb2pdu.c:3713:17: sparse: expression using sizeof(void)

vim +2613 fs/cifs/smb2pdu.c

  2565	
  2566	/*
  2567	 * To form a chain of read requests, any read requests after the first should
  2568	 * have the end_of_chain boolean set to true.
  2569	 */
  2570	static int
  2571	smb2_new_read_req(void **buf, unsigned int *total_len,
  2572		struct cifs_io_parms *io_parms, struct cifs_readdata *rdata,
  2573		unsigned int remaining_bytes, int request_type)
  2574	{
  2575		int rc = -EACCES;
  2576		struct smb2_read_plain_req *req = NULL;
  2577		struct smb2_sync_hdr *shdr;
  2578		struct TCP_Server_Info *server;
  2579	
  2580		rc = smb2_plain_req_init(SMB2_READ, io_parms->tcon, (void **) &req,
  2581					 total_len);
  2582		if (rc)
  2583			return rc;
  2584	
  2585		server = io_parms->tcon->ses->server;
  2586		if (server == NULL)
  2587			return -ECONNABORTED;
  2588	
  2589		shdr = &req->sync_hdr;
  2590		shdr->ProcessId = cpu_to_le32(io_parms->pid);
  2591	
  2592		req->PersistentFileId = io_parms->persistent_fid;
  2593		req->VolatileFileId = io_parms->volatile_fid;
  2594		req->ReadChannelInfoOffset = 0; /* reserved */
  2595		req->ReadChannelInfoLength = 0; /* reserved */
  2596		req->Channel = 0; /* reserved */
  2597		req->MinimumCount = 0;
  2598		req->Length = cpu_to_le32(io_parms->length);
  2599		req->Offset = cpu_to_le64(io_parms->offset);
  2600	#ifdef CONFIG_CIFS_SMB_DIRECT
  2601		/*
  2602		 * If we want to do a RDMA write, fill in and append
  2603		 * smbd_buffer_descriptor_v1 to the end of read request
  2604		 */
  2605		if (server->rdma && rdata && !server->sign &&
  2606			rdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) {
  2607	
  2608			struct smbd_buffer_descriptor_v1 *v1;
  2609			bool need_invalidate =
  2610				io_parms->tcon->ses->server->dialect == SMB30_PROT_ID;
  2611	
  2612			rcu_read_lock();
> 2613			rcu_dereference(server->smbd_conn);
  2614			rdata->mr = smbd_register_mr(
  2615					server->smbd_conn, rdata->pages,
  2616					rdata->nr_pages, rdata->tailsz,
  2617					true, need_invalidate);
  2618			rcu_read_unlock();
  2619			if (!rdata->mr)
  2620				return -ENOBUFS;
  2621	
  2622			req->Channel = SMB2_CHANNEL_RDMA_V1_INVALIDATE;
  2623			if (need_invalidate)
  2624				req->Channel = SMB2_CHANNEL_RDMA_V1;
  2625			req->ReadChannelInfoOffset =
  2626				cpu_to_le16(offsetof(struct smb2_read_plain_req, Buffer));
  2627			req->ReadChannelInfoLength =
  2628				cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1));
  2629			v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0];
  2630			v1->offset = cpu_to_le64(rdata->mr->mr->iova);
  2631			v1->token = cpu_to_le32(rdata->mr->mr->rkey);
  2632			v1->length = cpu_to_le32(rdata->mr->mr->length);
  2633	
  2634			*total_len += sizeof(*v1) - 1;
  2635		}
  2636	#endif
  2637		if (request_type & CHAINED_REQUEST) {
  2638			if (!(request_type & END_OF_CHAIN)) {
  2639				/* next 8-byte aligned request */
  2640				*total_len = DIV_ROUND_UP(*total_len, 8) * 8;
  2641				shdr->NextCommand = cpu_to_le32(*total_len);
  2642			} else /* END_OF_CHAIN */
  2643				shdr->NextCommand = 0;
  2644			if (request_type & RELATED_REQUEST) {
  2645				shdr->Flags |= SMB2_FLAGS_RELATED_OPERATIONS;
  2646				/*
  2647				 * Related requests use info from previous read request
  2648				 * in chain.
  2649				 */
  2650				shdr->SessionId = 0xFFFFFFFF;
  2651				shdr->TreeId = 0xFFFFFFFF;
  2652				req->PersistentFileId = 0xFFFFFFFF;
  2653				req->VolatileFileId = 0xFFFFFFFF;
  2654			}
  2655		}
  2656		if (remaining_bytes > io_parms->length)
  2657			req->RemainingBytes = cpu_to_le32(remaining_bytes);
  2658		else
  2659			req->RemainingBytes = 0;
  2660	
  2661		*buf = req;
  2662		return rc;
  2663	}
  2664	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

  reply	other threads:[~2018-05-08  6:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 22:20 [PATCH 1/7] cifs: smbd: Make upper layer decide when to destroy the transport Long Li
2018-05-07 22:20 ` [PATCH 2/7] cifs: smbd: Don't destroy transport on RDMA disconnect Long Li
2018-05-07 22:20 ` [PATCH 3/7] cifs: smbd: Return EINTR when interrupted Long Li
2018-05-07 22:20 ` [PATCH 4/7] cifs: smbd: Indicate to retry on transport sending failure Long Li
2018-05-07 22:20 ` [PATCH 5/7] cifs: smbd: Protect memory registration using RCU Long Li
2018-05-08  6:35   ` kbuild test robot [this message]
2018-05-08 22:16     ` Long Li
2018-05-07 22:20 ` [PATCH 6/7] cifs: smbd: Retry on memory registration failure Long Li
2018-05-07 22:20 ` [PATCH 7/7] cifs: Call MID callback before destroying transport Long Li
2018-05-08  3:45 ` [PATCH 1/7] cifs: smbd: Make upper layer decide when to destroy the transport kbuild test robot
2018-05-08  5:24 ` kbuild test robot
2018-05-08 19:29   ` Long Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201805081349.MX5qQDch%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@01.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@linuxonhyperv.com \
    --cc=longli@microsoft.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --subject='Re: [PATCH 5/7] cifs: smbd: Protect memory registration using RCU' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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