Skip to content

Commit 2d07c6c

Browse files
committed
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
2 parents 4ccb3a8 + 9bb3baa commit 2d07c6c

File tree

5 files changed

+38
-15
lines changed

5 files changed

+38
-15
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,19 +270,31 @@ ff_layout_remove_mirror(struct nfs4_ff_layout_mirror *mirror)
270270
mirror->layout = NULL;
271271
}
272272

273-
static struct nfs4_ff_layout_mirror *ff_layout_alloc_mirror(gfp_t gfp_flags)
273+
static struct nfs4_ff_layout_mirror *ff_layout_alloc_mirror(u32 dss_count,
274+
gfp_t gfp_flags)
274275
{
275276
struct nfs4_ff_layout_mirror *mirror;
276-
u32 dss_id;
277277

278278
mirror = kzalloc(sizeof(*mirror), gfp_flags);
279-
if (mirror != NULL) {
280-
spin_lock_init(&mirror->lock);
281-
refcount_set(&mirror->ref, 1);
282-
INIT_LIST_HEAD(&mirror->mirrors);
283-
for (dss_id = 0; dss_id < mirror->dss_count; dss_id++)
284-
nfs_localio_file_init(&mirror->dss[dss_id].nfl);
279+
if (mirror == NULL)
280+
return NULL;
281+
282+
spin_lock_init(&mirror->lock);
283+
refcount_set(&mirror->ref, 1);
284+
INIT_LIST_HEAD(&mirror->mirrors);
285+
286+
mirror->dss_count = dss_count;
287+
mirror->dss =
288+
kcalloc(dss_count, sizeof(struct nfs4_ff_layout_ds_stripe),
289+
gfp_flags);
290+
if (mirror->dss == NULL) {
291+
kfree(mirror);
292+
return NULL;
285293
}
294+
295+
for (u32 dss_id = 0; dss_id < mirror->dss_count; dss_id++)
296+
nfs_localio_file_init(&mirror->dss[dss_id].nfl);
297+
286298
return mirror;
287299
}
288300

@@ -507,17 +519,12 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
507519
if (dss_count > 1 && stripe_unit == 0)
508520
goto out_err_free;
509521

510-
fls->mirror_array[i] = ff_layout_alloc_mirror(gfp_flags);
522+
fls->mirror_array[i] = ff_layout_alloc_mirror(dss_count, gfp_flags);
511523
if (fls->mirror_array[i] == NULL) {
512524
rc = -ENOMEM;
513525
goto out_err_free;
514526
}
515527

516-
fls->mirror_array[i]->dss_count = dss_count;
517-
fls->mirror_array[i]->dss =
518-
kcalloc(dss_count, sizeof(struct nfs4_ff_layout_ds_stripe),
519-
gfp_flags);
520-
521528
for (dss_id = 0; dss_id < dss_count; dss_id++) {
522529
dss_info = &fls->mirror_array[i]->dss[dss_id];
523530
dss_info->mirror = fls->mirror_array[i];

fs/nfs/nfs4client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
222222
clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
223223
clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
224224
clp->cl_mig_gen = 1;
225+
clp->cl_last_renewal = jiffies;
225226
#if IS_ENABLED(CONFIG_NFS_V4_1)
226227
init_waitqueue_head(&clp->cl_lock_waitq);
227228
#endif

fs/nfs/nfs4proc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,6 +3636,7 @@ struct nfs4_closedata {
36363636
} lr;
36373637
struct nfs_fattr fattr;
36383638
unsigned long timestamp;
3639+
unsigned short retrans;
36393640
};
36403641

36413642
static void nfs4_free_closedata(void *data)
@@ -3664,6 +3665,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
36643665
.state = state,
36653666
.inode = calldata->inode,
36663667
.stateid = &calldata->arg.stateid,
3668+
.retrans = calldata->retrans,
36673669
};
36683670

36693671
if (!nfs4_sequence_done(task, &calldata->res.seq_res))
@@ -3711,6 +3713,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
37113713
default:
37123714
task->tk_status = nfs4_async_handle_exception(task,
37133715
server, task->tk_status, &exception);
3716+
calldata->retrans = exception.retrans;
37143717
if (exception.retry)
37153718
goto out_restart;
37163719
}
@@ -5593,9 +5596,11 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)
55935596
.inode = hdr->inode,
55945597
.state = hdr->args.context->state,
55955598
.stateid = &hdr->args.stateid,
5599+
.retrans = hdr->retrans,
55965600
};
55975601
task->tk_status = nfs4_async_handle_exception(task,
55985602
server, task->tk_status, &exception);
5603+
hdr->retrans = exception.retrans;
55995604
if (exception.retry) {
56005605
rpc_restart_call_prepare(task);
56015606
return -EAGAIN;
@@ -5709,10 +5714,12 @@ static int nfs4_write_done_cb(struct rpc_task *task,
57095714
.inode = hdr->inode,
57105715
.state = hdr->args.context->state,
57115716
.stateid = &hdr->args.stateid,
5717+
.retrans = hdr->retrans,
57125718
};
57135719
task->tk_status = nfs4_async_handle_exception(task,
57145720
NFS_SERVER(inode), task->tk_status,
57155721
&exception);
5722+
hdr->retrans = exception.retrans;
57165723
if (exception.retry) {
57175724
rpc_restart_call_prepare(task);
57185725
return -EAGAIN;
@@ -6726,6 +6733,7 @@ struct nfs4_delegreturndata {
67266733
struct nfs_fh fh;
67276734
nfs4_stateid stateid;
67286735
unsigned long timestamp;
6736+
unsigned short retrans;
67296737
struct {
67306738
struct nfs4_layoutreturn_args arg;
67316739
struct nfs4_layoutreturn_res res;
@@ -6746,6 +6754,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
67466754
.inode = data->inode,
67476755
.stateid = &data->stateid,
67486756
.task_is_privileged = data->args.seq_args.sa_privileged,
6757+
.retrans = data->retrans,
67496758
};
67506759

67516760
if (!nfs4_sequence_done(task, &data->res.seq_res))
@@ -6817,6 +6826,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
68176826
task->tk_status = nfs4_async_handle_exception(task,
68186827
data->res.server, task->tk_status,
68196828
&exception);
6829+
data->retrans = exception.retrans;
68206830
if (exception.retry)
68216831
goto out_restart;
68226832
}
@@ -7093,6 +7103,7 @@ struct nfs4_unlockdata {
70937103
struct file_lock fl;
70947104
struct nfs_server *server;
70957105
unsigned long timestamp;
7106+
unsigned short retrans;
70967107
};
70977108

70987109
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)
71477158
struct nfs4_exception exception = {
71487159
.inode = calldata->lsp->ls_state->inode,
71497160
.stateid = &calldata->arg.stateid,
7161+
.retrans = calldata->retrans,
71507162
};
71517163

71527164
if (!nfs4_sequence_done(task, &calldata->res.seq_res))
@@ -7180,6 +7192,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
71807192
task->tk_status = nfs4_async_handle_exception(task,
71817193
calldata->server, task->tk_status,
71827194
&exception);
7195+
calldata->retrans = exception.retrans;
71837196
if (exception.retry)
71847197
rpc_restart_call_prepare(task);
71857198
}

fs/nfs/write.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,8 @@ static int nfs_writeback_done(struct rpc_task *task,
15351535
/* Deal with the suid/sgid bit corner case */
15361536
if (nfs_should_remove_suid(inode)) {
15371537
spin_lock(&inode->i_lock);
1538-
nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE);
1538+
nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE
1539+
| NFS_INO_REVAL_FORCED);
15391540
spin_unlock(&inode->i_lock);
15401541
}
15411542
return 0;

include/linux/nfs_xdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,7 @@ struct nfs_pgio_header {
16591659
void *netfs;
16601660
#endif
16611661

1662+
unsigned short retrans;
16621663
int pnfs_error;
16631664
int error; /* merge with pnfs_error */
16641665
unsigned int good_bytes; /* boundary of good data */

0 commit comments

Comments
 (0)