History

NFSv4.1 mark qualified async operations as MOVEABLE tasks

Mark async operations such as RENAME, REMOVE, COMMIT MOVEABLE for the nfsv4.1+ sessions.

Olga Kornievskaia committed 4 years ago

Commit 118f09e1 parent 11270e75 files · +30 −12Browse files

Unified · Split

5 files
  1. fs/nfs/nfs4proc.c +14 −12
  2. fs/nfs/pagelist.c +3 −0
  3. fs/nfs/unlink.c +8 −0
  4. fs/nfs/write.c +4 −0
  5. include/linux/nfs_fs_sb.h +1 −0
fs/nfs/nfs4proc.c+14−12
@@ -1162,7 +1162,7 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt, · 1161 unmodified lines
11621162 {
11631163 unsigned short task_flags = 0;
11641164
1165− if (server->nfs_client->cl_minorversion)
1165+ if (server->caps & NFS_CAP_MOVEABLE)
11661166 task_flags = RPC_TASK_MOVEABLE;
11671167 return nfs4_do_call_sync(clnt, server, msg, args, res, task_flags);
11681168 }
@@ -2568,7 +2568,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, · 1399 unmodified lines
25682568 };
25692569 int status;
25702570
2571− if (server->nfs_client->cl_minorversion)
2571+ if (nfs_server_capable(dir, NFS_CAP_MOVEABLE))
25722572 task_setup_data.flags |= RPC_TASK_MOVEABLE;
25732573
25742574 kref_get(&data->kref);
@@ -3737,7 +3737,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait) · 1162 unmodified lines
37373737 };
37383738 int status = -ENOMEM;
37393739
3740− if (server->nfs_client->cl_minorversion)
3740+ if (nfs_server_capable(state->inode, NFS_CAP_MOVEABLE))
37413741 task_setup_data.flags |= RPC_TASK_MOVEABLE;
37423742
37433743 nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_CLEANUP,
@@ -4407,7 +4407,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, · 663 unmodified lines
44074407 };
44084408 unsigned short task_flags = 0;
44094409
4410− if (server->nfs_client->cl_minorversion)
4410+ if (nfs_server_capable(dir, NFS_CAP_MOVEABLE))
44114411 task_flags = RPC_TASK_MOVEABLE;
44124412
44134413 /* Is this is an attribute revalidation, subject to softreval? */
@@ -6639,10 +6639,13 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, · 2225 unmodified lines
66396639 .rpc_client = server->client,
66406640 .rpc_message = &msg,
66416641 .callback_ops = &nfs4_delegreturn_ops,
6642− .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT | RPC_TASK_MOVEABLE,
6642+ .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
66436643 };
66446644 int status = 0;
66456645
6646+ if (nfs_server_capable(inode, NFS_CAP_MOVEABLE))
6647+ task_setup_data.flags |= RPC_TASK_MOVEABLE;
6648+
66466649 data = kzalloc(sizeof(*data), GFP_KERNEL);
66476650 if (data == NULL)
66486651 return -ENOMEM;
@@ -6956,10 +6959,8 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, · 307 unmodified lines
69566959 .workqueue = nfsiod_workqueue,
69576960 .flags = RPC_TASK_ASYNC,
69586961 };
6959− struct nfs_client *client =
6960− NFS_SERVER(lsp->ls_state->inode)->nfs_client;
69616962
6962− if (client->cl_minorversion)
6963+ if (nfs_server_capable(lsp->ls_state->inode, NFS_CAP_MOVEABLE))
69636964 task_setup_data.flags |= RPC_TASK_MOVEABLE;
69646965
69656966 nfs4_state_protect(NFS_SERVER(lsp->ls_state->inode)->nfs_client,
@@ -7230,9 +7231,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f · 264 unmodified lines
72307231 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
72317232 };
72327233 int ret;
7233− struct nfs_client *client = NFS_SERVER(state->inode)->nfs_client;
72347234
7235− if (client->cl_minorversion)
7235+ if (nfs_server_capable(state->inode, NFS_CAP_MOVEABLE))
72367236 task_setup_data.flags |= RPC_TASK_MOVEABLE;
72377237
72387238 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file),
@@ -10467,7 +10467,8 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { · 3228 unmodified lines
1046710467 | NFS_CAP_POSIX_LOCK
1046810468 | NFS_CAP_STATEID_NFSV41
1046910469 | NFS_CAP_ATOMIC_OPEN_V1
10470− | NFS_CAP_LGOPEN,
10470+ | NFS_CAP_LGOPEN
10471+ | NFS_CAP_MOVEABLE,
1047110472 .init_client = nfs41_init_client,
1047210473 .shutdown_client = nfs41_shutdown_client,
1047310474 .match_stateid = nfs41_match_stateid,
@@ -10502,7 +10503,8 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = { · 28 unmodified lines
1050210503 | NFS_CAP_LAYOUTSTATS
1050310504 | NFS_CAP_CLONE
1050410505 | NFS_CAP_LAYOUTERROR
10505− | NFS_CAP_READ_PLUS,
10506+ | NFS_CAP_READ_PLUS
10507+ | NFS_CAP_MOVEABLE,
1050610508 .init_client = nfs41_init_client,
1050710509 .shutdown_client = nfs41_shutdown_client,
1050810510 .match_stateid = nfs41_match_stateid,
fs/nfs/pagelist.c+3−0
@@ -767,6 +767,9 @@ int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr, · 766 unmodified lines
767767 .flags = RPC_TASK_ASYNC | flags,
768768 };
769769
770+ if (nfs_server_capable(hdr->inode, NFS_CAP_MOVEABLE))
771+ task_setup_data.flags |= RPC_TASK_MOVEABLE;
772+
770773 hdr->rw_ops->rw_initiate(hdr, &msg, rpc_ops, &task_setup_data, how);
771774
772775 dprintk("NFS: initiated pgio call "
fs/nfs/unlink.c+8−0
@@ -102,6 +102,10 @@ static void nfs_do_call_unlink(struct inode *inode, struct nfs_unlinkdata *data) · 101 unmodified lines
102102 };
103103 struct rpc_task *task;
104104 struct inode *dir = d_inode(data->dentry->d_parent);
105+
106+ if (nfs_server_capable(inode, NFS_CAP_MOVEABLE))
107+ task_setup_data.flags |= RPC_TASK_MOVEABLE;
108+
105109 nfs_sb_active(dir->i_sb);
106110 data->args.fh = NFS_FH(dir);
107111 nfs_fattr_init(data->res.dir_attr);
@@ -344,6 +348,10 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir, · 236 unmodified lines
344348 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
345349 };
346350
351+ if (nfs_server_capable(old_dir, NFS_CAP_MOVEABLE) &&
352+ nfs_server_capable(new_dir, NFS_CAP_MOVEABLE))
353+ task_setup_data.flags |= RPC_TASK_MOVEABLE;
354+
347355 data = kzalloc(sizeof(*data), GFP_KERNEL);
348356 if (data == NULL)
349357 return ERR_PTR(-ENOMEM);
fs/nfs/write.c+4−0
@@ -1709,6 +1709,10 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, · 1708 unmodified lines
17091709 .flags = RPC_TASK_ASYNC | flags,
17101710 .priority = priority,
17111711 };
1712+
1713+ if (nfs_server_capable(data->inode, NFS_CAP_MOVEABLE))
1714+ task_setup_data.flags |= RPC_TASK_MOVEABLE;
1715+
17121716 /* Set up the initial task struct. */
17131717 nfs_ops->commit_setup(data, &msg, &task_setup_data.rpc_client);
17141718 trace_nfs_initiate_commit(data);
include/linux/nfs_fs_sb.h+1−0
@@ -287,4 +287,5 @@ struct nfs_server { · 286 unmodified lines
287287 #define NFS_CAP_XATTR (1U << 28)
288288 #define NFS_CAP_READ_PLUS (1U << 29)
289289 #define NFS_CAP_FS_LOCATIONS (1U << 30)
290+#define NFS_CAP_MOVEABLE (1U << 31)
290291 #endif