Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89e25567 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'nfsd-4.18' of git://linux-nfs.org/~bfields/linux

Pull nfsd updates from Bruce Fields:
 "A relatively quiet cycle for nfsd.

  The largest piece is an RDMA update from Chuck Lever with new trace
  points, miscellaneous cleanups, and streamlining of the send and
  receive paths.

  Other than that, some miscellaneous bugfixes"

* tag 'nfsd-4.18' of git://linux-nfs.org/~bfields/linux: (26 commits)
  nfsd: fix error handling in nfs4_set_delegation()
  nfsd: fix potential use-after-free in nfsd4_decode_getdeviceinfo
  Fix 16-byte memory leak in gssp_accept_sec_context_upcall
  svcrdma: Fix incorrect return value/type in svc_rdma_post_recvs
  svcrdma: Remove unused svc_rdma_op_ctxt
  svcrdma: Persistently allocate and DMA-map Send buffers
  svcrdma: Simplify svc_rdma_send()
  svcrdma: Remove post_send_wr
  svcrdma: Don't overrun the SGE array in svc_rdma_send_ctxt
  svcrdma: Introduce svc_rdma_send_ctxt
  svcrdma: Clean up Send SGE accounting
  svcrdma: Refactor svc_rdma_dma_map_buf
  svcrdma: Allocate recv_ctxt's on CPU handling Receives
  svcrdma: Persistently allocate and DMA-map Receive buffers
  svcrdma: Preserve Receive buffer until svc_rdma_sendto
  svcrdma: Simplify svc_rdma_recv_ctxt_put
  svcrdma: Remove sc_rq_depth
  svcrdma: Introduce svc_rdma_recv_ctxt
  svcrdma: Trace key RDMA API events
  svcrdma: Trace key RPC/RDMA protocol events
  ...
parents 8efcf34a 692ad280
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -216,13 +216,21 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
	struct request_queue *q = bdev->bd_disk->queue;
	struct request_queue *q = bdev->bd_disk->queue;
	struct request *rq;
	struct request *rq;
	struct scsi_request *req;
	struct scsi_request *req;
	size_t bufflen = 252, len, id_len;
	/*
	 * The allocation length (passed in bytes 3 and 4 of the INQUIRY
	 * command descriptor block) specifies the number of bytes that have
	 * been allocated for the data-in buffer.
	 * 252 is the highest one-byte value that is a multiple of 4.
	 * 65532 is the highest two-byte value that is a multiple of 4.
	 */
	size_t bufflen = 252, maxlen = 65532, len, id_len;
	u8 *buf, *d, type, assoc;
	u8 *buf, *d, type, assoc;
	int error;
	int retries = 1, error;


	if (WARN_ON_ONCE(!blk_queue_scsi_passthrough(q)))
	if (WARN_ON_ONCE(!blk_queue_scsi_passthrough(q)))
		return -EINVAL;
		return -EINVAL;


again:
	buf = kzalloc(bufflen, GFP_KERNEL);
	buf = kzalloc(bufflen, GFP_KERNEL);
	if (!buf)
	if (!buf)
		return -ENOMEM;
		return -ENOMEM;
@@ -255,6 +263,12 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,


	len = (buf[2] << 8) + buf[3] + 4;
	len = (buf[2] << 8) + buf[3] + 4;
	if (len > bufflen) {
	if (len > bufflen) {
		if (len <= maxlen && retries--) {
			blk_put_request(rq);
			kfree(buf);
			bufflen = len;
			goto again;
		}
		pr_err("pNFS: INQUIRY 0x83 response invalid (len = %zd)\n",
		pr_err("pNFS: INQUIRY 0x83 response invalid (len = %zd)\n",
			len);
			len);
		goto out_put_request;
		goto out_put_request;
+0 −5
Original line number Original line Diff line number Diff line
@@ -67,11 +67,6 @@ enum {
	RC_REPLBUFF,
	RC_REPLBUFF,
};
};


/*
 * If requests are retransmitted within this interval, they're dropped.
 */
#define RC_DELAY		(HZ/5)

/* Cache entries expire after this time period */
/* Cache entries expire after this time period */
#define RC_EXPIRE		(120 * HZ)
#define RC_EXPIRE		(120 * HZ)


+4 −1
Original line number Original line Diff line number Diff line
@@ -4378,8 +4378,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
	spin_unlock(&state_lock);
	spin_unlock(&state_lock);


	if (status)
	if (status)
		destroy_unhashed_deleg(dp);
		goto out_unlock;

	return dp;
	return dp;
out_unlock:
	vfs_setlease(fp->fi_deleg_file, F_UNLCK, NULL, (void **)&dp);
out_clnt_odstate:
out_clnt_odstate:
	put_clnt_odstate(dp->dl_clnt_odstate);
	put_clnt_odstate(dp->dl_clnt_odstate);
out_stid:
out_stid:
+5 −2
Original line number Original line Diff line number Diff line
@@ -1585,6 +1585,8 @@ nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
	gdev->gd_maxcount = be32_to_cpup(p++);
	gdev->gd_maxcount = be32_to_cpup(p++);
	num = be32_to_cpup(p++);
	num = be32_to_cpup(p++);
	if (num) {
	if (num) {
		if (num > 1000)
			goto xdr_error;
		READ_BUF(4 * num);
		READ_BUF(4 * num);
		gdev->gd_notify_types = be32_to_cpup(p++);
		gdev->gd_notify_types = be32_to_cpup(p++);
		for (i = 1; i < num; i++) {
		for (i = 1; i < num; i++) {
@@ -3651,7 +3653,8 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
		nfserr = nfserr_resource;
		nfserr = nfserr_resource;
		goto err_no_verf;
		goto err_no_verf;
	}
	}
	maxcount = min_t(u32, readdir->rd_maxcount, INT_MAX);
	maxcount = svc_max_payload(resp->rqstp);
	maxcount = min_t(u32, readdir->rd_maxcount, maxcount);
	/*
	/*
	 * Note the rfc defines rd_maxcount as the size of the
	 * Note the rfc defines rd_maxcount as the size of the
	 * READDIR4resok structure, which includes the verifier above
	 * READDIR4resok structure, which includes the verifier above
@@ -3665,7 +3668,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4


	/* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */
	/* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */
	if (!readdir->rd_dircount)
	if (!readdir->rd_dircount)
		readdir->rd_dircount = INT_MAX;
		readdir->rd_dircount = svc_max_payload(resp->rqstp);


	readdir->xdr = xdr;
	readdir->xdr = xdr;
	readdir->rd_maxcount = maxcount;
	readdir->rd_maxcount = maxcount;
+2 −4
Original line number Original line Diff line number Diff line
@@ -394,7 +394,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
	__wsum			csum;
	__wsum			csum;
	u32 hash = nfsd_cache_hash(xid);
	u32 hash = nfsd_cache_hash(xid);
	struct nfsd_drc_bucket *b = &drc_hashtbl[hash];
	struct nfsd_drc_bucket *b = &drc_hashtbl[hash];
	unsigned long		age;
	int type = rqstp->rq_cachetype;
	int type = rqstp->rq_cachetype;
	int rtn = RC_DOIT;
	int rtn = RC_DOIT;


@@ -461,12 +460,11 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
found_entry:
found_entry:
	nfsdstats.rchits++;
	nfsdstats.rchits++;
	/* We found a matching entry which is either in progress or done. */
	/* We found a matching entry which is either in progress or done. */
	age = jiffies - rp->c_timestamp;
	lru_put_end(b, rp);
	lru_put_end(b, rp);


	rtn = RC_DROPIT;
	rtn = RC_DROPIT;
	/* Request being processed or excessive rexmits */
	/* Request being processed */
	if (rp->c_state == RC_INPROG || age < RC_DELAY)
	if (rp->c_state == RC_INPROG)
		goto out;
		goto out;


	/* From the hall of fame of impractical attacks:
	/* From the hall of fame of impractical attacks:
Loading