Commit 2d07c6c2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'nfs-for-6.18-2' of git://git.linux-nfs.org/projects/anna/linux-nfs

Pull NFS client fixes from Anna Schumaker:

 - Fix for FlexFiles mirror->dss allocation

 - Apply delay_retrans to async operations

 - Check if suid/sgid is cleared after a write when needed

 - Fix setting the state renewal timer for early mounts after a reboot

* tag 'nfs-for-6.18-2' of git://git.linux-nfs.org/projects/anna/linux-nfs:
  NFS4: Fix state renewals missing after boot
  NFS: check if suid/sgid was cleared after a write as needed
  NFS4: Apply delay_retrans to async operations
  NFSv4/flexfiles: fix to allocate mirror->dss before use
parents 4ccb3a80 9bb3baa9
Loading
Loading
Loading
Loading
+21 −14
Original line number Diff line number Diff line
@@ -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) {
	if (mirror == NULL)
		return 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);

	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];
+1 −0
Original line number Diff line number Diff line
@@ -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
+13 −0
Original line number Diff line number Diff line
@@ -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);
	}
+2 −1
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -1659,6 +1659,7 @@ struct nfs_pgio_header {
	void			*netfs;
#endif

	unsigned short		retrans;
	int			pnfs_error;
	int			error;		/* merge with pnfs_error */
	unsigned int		good_bytes;	/* boundary of good data */