diff options
Diffstat (limited to 'fs/nfs')
| -rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.c | 35 | ||||
| -rw-r--r-- | fs/nfs/nfs4client.c | 1 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 13 | ||||
| -rw-r--r-- | fs/nfs/write.c | 3 | 
4 files changed, 37 insertions, 15 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index df01d2876b68..9056f05a67dc 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -270,19 +270,31 @@ ff_layout_remove_mirror(struct nfs4_ff_layout_mirror *mirror)  	mirror->layout = NULL;  } -static struct nfs4_ff_layout_mirror *ff_layout_alloc_mirror(gfp_t gfp_flags) +static struct nfs4_ff_layout_mirror *ff_layout_alloc_mirror(u32 dss_count, +							    gfp_t gfp_flags)  {  	struct nfs4_ff_layout_mirror *mirror; -	u32 dss_id;  	mirror = kzalloc(sizeof(*mirror), gfp_flags); -	if (mirror != NULL) { -		spin_lock_init(&mirror->lock); -		refcount_set(&mirror->ref, 1); -		INIT_LIST_HEAD(&mirror->mirrors); -		for (dss_id = 0; dss_id < mirror->dss_count; dss_id++) -			nfs_localio_file_init(&mirror->dss[dss_id].nfl); +	if (mirror == NULL) +		return NULL; + +	spin_lock_init(&mirror->lock); +	refcount_set(&mirror->ref, 1); +	INIT_LIST_HEAD(&mirror->mirrors); + +	mirror->dss_count = dss_count; +	mirror->dss = +		kcalloc(dss_count, sizeof(struct nfs4_ff_layout_ds_stripe), +			gfp_flags); +	if (mirror->dss == NULL) { +		kfree(mirror); +		return NULL;  	} + +	for (u32 dss_id = 0; dss_id < mirror->dss_count; dss_id++) +		nfs_localio_file_init(&mirror->dss[dss_id].nfl); +  	return mirror;  } @@ -507,17 +519,12 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,  		if (dss_count > 1 && stripe_unit == 0)  			goto out_err_free; -		fls->mirror_array[i] = ff_layout_alloc_mirror(gfp_flags); +		fls->mirror_array[i] = ff_layout_alloc_mirror(dss_count, gfp_flags);  		if (fls->mirror_array[i] == NULL) {  			rc = -ENOMEM;  			goto out_err_free;  		} -		fls->mirror_array[i]->dss_count = dss_count; -		fls->mirror_array[i]->dss = -		    kcalloc(dss_count, sizeof(struct nfs4_ff_layout_ds_stripe), -			    gfp_flags); -  		for (dss_id = 0; dss_id < dss_count; dss_id++) {  			dss_info = &fls->mirror_array[i]->dss[dss_id];  			dss_info->mirror = fls->mirror_array[i]; diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 6fddf43d729c..5998d6bd8a4f 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -222,6 +222,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)  	clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;  	clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];  	clp->cl_mig_gen = 1; +	clp->cl_last_renewal = jiffies;  #if IS_ENABLED(CONFIG_NFS_V4_1)  	init_waitqueue_head(&clp->cl_lock_waitq);  #endif diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f58098417142..411776718494 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3636,6 +3636,7 @@ struct nfs4_closedata {  	} lr;  	struct nfs_fattr fattr;  	unsigned long timestamp; +	unsigned short retrans;  };  static void nfs4_free_closedata(void *data) @@ -3664,6 +3665,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)  		.state = state,  		.inode = calldata->inode,  		.stateid = &calldata->arg.stateid, +		.retrans = calldata->retrans,  	};  	if (!nfs4_sequence_done(task, &calldata->res.seq_res)) @@ -3711,6 +3713,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)  		default:  			task->tk_status = nfs4_async_handle_exception(task,  					server, task->tk_status, &exception); +			calldata->retrans = exception.retrans;  			if (exception.retry)  				goto out_restart;  	} @@ -5593,9 +5596,11 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)  			.inode = hdr->inode,  			.state = hdr->args.context->state,  			.stateid = &hdr->args.stateid, +			.retrans = hdr->retrans,  		};  		task->tk_status = nfs4_async_handle_exception(task,  				server, task->tk_status, &exception); +		hdr->retrans = exception.retrans;  		if (exception.retry) {  			rpc_restart_call_prepare(task);  			return -EAGAIN; @@ -5709,10 +5714,12 @@ static int nfs4_write_done_cb(struct rpc_task *task,  			.inode = hdr->inode,  			.state = hdr->args.context->state,  			.stateid = &hdr->args.stateid, +			.retrans = hdr->retrans,  		};  		task->tk_status = nfs4_async_handle_exception(task,  				NFS_SERVER(inode), task->tk_status,  				&exception); +		hdr->retrans = exception.retrans;  		if (exception.retry) {  			rpc_restart_call_prepare(task);  			return -EAGAIN; @@ -6726,6 +6733,7 @@ struct nfs4_delegreturndata {  	struct nfs_fh fh;  	nfs4_stateid stateid;  	unsigned long timestamp; +	unsigned short retrans;  	struct {  		struct nfs4_layoutreturn_args arg;  		struct nfs4_layoutreturn_res res; @@ -6746,6 +6754,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)  		.inode = data->inode,  		.stateid = &data->stateid,  		.task_is_privileged = data->args.seq_args.sa_privileged, +		.retrans = data->retrans,  	};  	if (!nfs4_sequence_done(task, &data->res.seq_res)) @@ -6817,6 +6826,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)  		task->tk_status = nfs4_async_handle_exception(task,  				data->res.server, task->tk_status,  				&exception); +		data->retrans = exception.retrans;  		if (exception.retry)  			goto out_restart;  	} @@ -7093,6 +7103,7 @@ struct nfs4_unlockdata {  	struct file_lock fl;  	struct nfs_server *server;  	unsigned long timestamp; +	unsigned short retrans;  };  static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, @@ -7147,6 +7158,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)  	struct nfs4_exception exception = {  		.inode = calldata->lsp->ls_state->inode,  		.stateid = &calldata->arg.stateid, +		.retrans = calldata->retrans,  	};  	if (!nfs4_sequence_done(task, &calldata->res.seq_res)) @@ -7180,6 +7192,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)  			task->tk_status = nfs4_async_handle_exception(task,  					calldata->server, task->tk_status,  					&exception); +			calldata->retrans = exception.retrans;  			if (exception.retry)  				rpc_restart_call_prepare(task);  	} diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0fb6905736d5..336c510f3750 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1535,7 +1535,8 @@ static int nfs_writeback_done(struct rpc_task *task,  	/* Deal with the suid/sgid bit corner case */  	if (nfs_should_remove_suid(inode)) {  		spin_lock(&inode->i_lock); -		nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE); +		nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE +				| NFS_INO_REVAL_FORCED);  		spin_unlock(&inode->i_lock);  	}  	return 0;  | 
