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

Commit 0d9f9e12 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-2.6.36' of git://linux-nfs.org/~bfields/linux

* 'for-2.6.36' of git://linux-nfs.org/~bfields/linux: (34 commits)
  nfsd4: fix file open accounting for RDWR opens
  nfsd: don't allow setting maxblksize after svc created
  nfsd: initialize nfsd versions before creating svc
  net: sunrpc: removed duplicated #include
  nfsd41: Fix a crash when a callback is retried
  nfsd: fix startup/shutdown order bug
  nfsd: minor nfsd read api cleanup
  gcc-4.6: nfsd: fix initialized but not read warnings
  nfsd4: share file descriptors between stateid's
  nfsd4: fix openmode checking on IO using lock stateid
  nfsd4: miscellaneous process_open2 cleanup
  nfsd4: don't pretend to support write delegations
  nfsd: bypass readahead cache when have struct file
  nfsd: minor nfsd_svc() cleanup
  nfsd: move more into nfsd_startup()
  nfsd: just keep single lockd reference for nfsd
  nfsd: clean up nfsd_create_serv error handling
  nfsd: fix error handling in __write_ports_addxprt
  nfsd: fix error handling when starting nfsd with rpcbind down
  nfsd4: fix v4 state shutdown error paths
  ...
parents df44f9f4 998db52c
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -168,7 +168,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
	svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
	svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);


	fh_copy(&resp->fh, &argp->fh);
	fh_copy(&resp->fh, &argp->fh);
	nfserr = nfsd_read(rqstp, &resp->fh, NULL,
	nfserr = nfsd_read(rqstp, &resp->fh,
				  argp->offset,
				  argp->offset,
			   	  rqstp->rq_vec, argp->vlen,
			   	  rqstp->rq_vec, argp->vlen,
				  &resp->count);
				  &resp->count);
@@ -271,7 +271,7 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
	fh_init(&resp->fh, NFS3_FHSIZE);
	fh_init(&resp->fh, NFS3_FHSIZE);
	nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
	nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
				    &argp->attrs, S_IFDIR, 0, &resp->fh);
				    &argp->attrs, S_IFDIR, 0, &resp->fh);

	fh_unlock(&resp->dirfh);
	RETURN_STATUS(nfserr);
	RETURN_STATUS(nfserr);
}
}


@@ -327,7 +327,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
	type = nfs3_ftypes[argp->ftype];
	type = nfs3_ftypes[argp->ftype];
	nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
	nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
				    &argp->attrs, type, rdev, &resp->fh);
				    &argp->attrs, type, rdev, &resp->fh);

	fh_unlock(&resp->dirfh);
	RETURN_STATUS(nfserr);
	RETURN_STATUS(nfserr);
}
}


@@ -348,6 +348,7 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
	/* Unlink. -S_IFDIR means file must not be a directory */
	/* Unlink. -S_IFDIR means file must not be a directory */
	fh_copy(&resp->fh, &argp->fh);
	fh_copy(&resp->fh, &argp->fh);
	nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len);
	nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len);
	fh_unlock(&resp->fh);
	RETURN_STATUS(nfserr);
	RETURN_STATUS(nfserr);
}
}


@@ -367,6 +368,7 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,


	fh_copy(&resp->fh, &argp->fh);
	fh_copy(&resp->fh, &argp->fh);
	nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len);
	nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len);
	fh_unlock(&resp->fh);
	RETURN_STATUS(nfserr);
	RETURN_STATUS(nfserr);
}
}


+32 −25
Original line number Original line Diff line number Diff line
@@ -143,8 +143,6 @@ struct nfs4_cb_compound_hdr {
	u32		minorversion;
	u32		minorversion;
	/* res */
	/* res */
	int		status;
	int		status;
	u32		taglen;
	char		*tag;
};
};


static struct {
static struct {
@@ -204,6 +202,16 @@ nfs_cb_stat_to_errno(int stat)
 * XDR encode
 * XDR encode
 */
 */


static void
encode_stateid(struct xdr_stream *xdr, stateid_t *sid)
{
	__be32 *p;

	RESERVE_SPACE(sizeof(stateid_t));
	WRITE32(sid->si_generation);
	WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
}

static void
static void
encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
{
{
@@ -229,10 +237,10 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp,
	__be32 *p;
	__be32 *p;
	int len = dp->dl_fh.fh_size;
	int len = dp->dl_fh.fh_size;


	RESERVE_SPACE(12+sizeof(dp->dl_stateid) + len);
	RESERVE_SPACE(4);
	WRITE32(OP_CB_RECALL);
	WRITE32(OP_CB_RECALL);
	WRITE32(dp->dl_stateid.si_generation);
	encode_stateid(xdr, &dp->dl_stateid);
	WRITEMEM(&dp->dl_stateid.si_opaque, sizeof(stateid_opaque_t));
	RESERVE_SPACE(8 + (XDR_QUADLEN(len) << 2));
	WRITE32(0); /* truncate optimization not implemented */
	WRITE32(0); /* truncate optimization not implemented */
	WRITE32(len);
	WRITE32(len);
	WRITEMEM(&dp->dl_fh.fh_base, len);
	WRITEMEM(&dp->dl_fh.fh_base, len);
@@ -293,13 +301,14 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p,
static int
static int
decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){
decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){
        __be32 *p;
        __be32 *p;
	u32 taglen;


        READ_BUF(8);
        READ_BUF(8);
        READ32(hdr->status);
        READ32(hdr->status);
        READ32(hdr->taglen);
	/* We've got no use for the tag; ignore it: */
        READ_BUF(hdr->taglen + 4);
        READ32(taglen);
        hdr->tag = (char *)p;
        READ_BUF(taglen + 4);
        p += XDR_QUADLEN(hdr->taglen);
        p += XDR_QUADLEN(taglen);
        READ32(hdr->nops);
        READ32(hdr->nops);
        return 0;
        return 0;
}
}
@@ -667,28 +676,28 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
	}
	}


	switch (task->tk_status) {
	switch (task->tk_status) {
	case -EIO:
	case 0:
		/* Network partition? */
		atomic_set(&clp->cl_cb_set, 0);
		warn_no_callback_path(clp, task->tk_status);
		if (current_rpc_client != task->tk_client) {
			/* queue a callback on the new connection: */
			nfsd4_cb_recall(dp);
		return;
		return;
		}
	case -EBADHANDLE:
	case -EBADHANDLE:
	case -NFS4ERR_BAD_STATEID:
	case -NFS4ERR_BAD_STATEID:
		/* Race: client probably got cb_recall
		/* Race: client probably got cb_recall
		 * before open reply granting delegation */
		 * before open reply granting delegation */
		break;
		break;
	default:
	default:
		/* success, or error we can't handle */
		/* Network partition? */
		atomic_set(&clp->cl_cb_set, 0);
		warn_no_callback_path(clp, task->tk_status);
		if (current_rpc_client != task->tk_client) {
			/* queue a callback on the new connection: */
			atomic_inc(&dp->dl_count);
			nfsd4_cb_recall(dp);
			return;
			return;
		}
		}
	}
	if (dp->dl_retries--) {
	if (dp->dl_retries--) {
		rpc_delay(task, 2*HZ);
		rpc_delay(task, 2*HZ);
		task->tk_status = 0;
		task->tk_status = 0;
		rpc_restart_call(task);
		rpc_restart_call_prepare(task);
		return;
		return;
	} else {
	} else {
		atomic_set(&clp->cl_cb_set, 0);
		atomic_set(&clp->cl_cb_set, 0);
@@ -752,18 +761,16 @@ static void _nfsd4_cb_recall(struct nfs4_delegation *dp)
		.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL],
		.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL],
		.rpc_cred = callback_cred
		.rpc_cred = callback_cred
	};
	};
	int status;


	if (clnt == NULL)
	if (clnt == NULL) {
		nfs4_put_delegation(dp);
		return; /* Client is shutting down; give up. */
		return; /* Client is shutting down; give up. */
	}


	args->args_op = dp;
	args->args_op = dp;
	msg.rpc_argp = args;
	msg.rpc_argp = args;
	dp->dl_retries = 1;
	dp->dl_retries = 1;
	status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT,
	rpc_call_async(clnt, &msg, RPC_TASK_SOFT, &nfsd4_cb_recall_ops, dp);
				&nfsd4_cb_recall_ops, dp);
	if (status)
		nfs4_put_delegation(dp);
}
}


void nfsd4_do_callback_rpc(struct work_struct *w)
void nfsd4_do_callback_rpc(struct work_struct *w)
+235 −146

File changed.

Preview size limit exceeded, changes collapsed.

+2 −1
Original line number Original line Diff line number Diff line
@@ -2630,7 +2630,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
	}
	}
	read->rd_vlen = v;
	read->rd_vlen = v;


	nfserr = nfsd_read(read->rd_rqstp, read->rd_fhp, read->rd_filp,
	nfserr = nfsd_read_file(read->rd_rqstp, read->rd_fhp, read->rd_filp,
			read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen,
			read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen,
			&maxcount);
			&maxcount);


@@ -3325,6 +3325,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo
		}
		}
		/* Renew the clientid on success and on replay */
		/* Renew the clientid on success and on replay */
		release_session_client(cs->session);
		release_session_client(cs->session);
		nfsd4_put_session(cs->session);
	}
	}
	return 1;
	return 1;
}
}
+11 −13
Original line number Original line Diff line number Diff line
@@ -949,15 +949,12 @@ static ssize_t __write_ports_addfd(char *buf)
	if (err != 0)
	if (err != 0)
		return err;
		return err;


	err = lockd_up();
	if (err != 0)
		goto out;

	err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
	err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
	if (err < 0)
	if (err < 0) {
		lockd_down();
		svc_destroy(nfsd_serv);
		return err;
	}


out:
	/* Decrease the count, but don't shut down the service */
	/* Decrease the count, but don't shut down the service */
	nfsd_serv->sv_nrthreads--;
	nfsd_serv->sv_nrthreads--;
	return err;
	return err;
@@ -978,9 +975,6 @@ static ssize_t __write_ports_delfd(char *buf)
	if (nfsd_serv != NULL)
	if (nfsd_serv != NULL)
		len = svc_sock_names(nfsd_serv, buf,
		len = svc_sock_names(nfsd_serv, buf,
					SIMPLE_TRANSACTION_LIMIT, toclose);
					SIMPLE_TRANSACTION_LIMIT, toclose);
	if (len >= 0)
		lockd_down();

	kfree(toclose);
	kfree(toclose);
	return len;
	return len;
}
}
@@ -1014,6 +1008,9 @@ static ssize_t __write_ports_addxprt(char *buf)
				PF_INET6, port, SVC_SOCK_ANONYMOUS);
				PF_INET6, port, SVC_SOCK_ANONYMOUS);
	if (err < 0 && err != -EAFNOSUPPORT)
	if (err < 0 && err != -EAFNOSUPPORT)
		goto out_close;
		goto out_close;

	/* Decrease the count, but don't shut down the service */
	nfsd_serv->sv_nrthreads--;
	return 0;
	return 0;
out_close:
out_close:
	xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
	xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
@@ -1022,8 +1019,7 @@ out_close:
		svc_xprt_put(xprt);
		svc_xprt_put(xprt);
	}
	}
out_err:
out_err:
	/* Decrease the count, but don't shut down the service */
	svc_destroy(nfsd_serv);
	nfsd_serv->sv_nrthreads--;
	return err;
	return err;
}
}


@@ -1194,7 +1190,7 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
			bsize = NFSSVC_MAXBLKSIZE;
			bsize = NFSSVC_MAXBLKSIZE;
		bsize &= ~(1024-1);
		bsize &= ~(1024-1);
		mutex_lock(&nfsd_mutex);
		mutex_lock(&nfsd_mutex);
		if (nfsd_serv && nfsd_serv->sv_nrthreads) {
		if (nfsd_serv) {
			mutex_unlock(&nfsd_mutex);
			mutex_unlock(&nfsd_mutex);
			return -EBUSY;
			return -EBUSY;
		}
		}
@@ -1310,6 +1306,8 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size)
			return -EINVAL;
			return -EINVAL;


		status = nfs4_reset_recoverydir(recdir);
		status = nfs4_reset_recoverydir(recdir);
		if (status)
			return status;
	}
	}


	return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n",
	return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n",
Loading