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
1162{1162{
1163 unsigned short task_flags = 0;1163 unsigned short task_flags = 0;
1164 1164
1165 if (server->nfs_client->cl_minorversion)1165 if (server->caps & NFS_CAP_MOVEABLE)
1166 task_flags = RPC_TASK_MOVEABLE;1166 task_flags = RPC_TASK_MOVEABLE;
1167 return nfs4_do_call_sync(clnt, server, msg, args, res, task_flags);1167 return nfs4_do_call_sync(clnt, server, msg, args, res, task_flags);
1168}1168}
@@ -2568,7 +2568,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, · 1399 unmodified lines
2568 };2568 };
2569 int status;2569 int status;
2570 2570
2571 if (server->nfs_client->cl_minorversion)2571 if (nfs_server_capable(dir, NFS_CAP_MOVEABLE))
2572 task_setup_data.flags |= RPC_TASK_MOVEABLE;2572 task_setup_data.flags |= RPC_TASK_MOVEABLE;
2573 2573
2574 kref_get(&data->kref);2574 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
3737 };3737 };
3738 int status = -ENOMEM;3738 int status = -ENOMEM;
3739 3739
3740 if (server->nfs_client->cl_minorversion)3740 if (nfs_server_capable(state->inode, NFS_CAP_MOVEABLE))
3741 task_setup_data.flags |= RPC_TASK_MOVEABLE;3741 task_setup_data.flags |= RPC_TASK_MOVEABLE;
3742 3742
3743 nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_CLEANUP,3743 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
4407 };4407 };
4408 unsigned short task_flags = 0;4408 unsigned short task_flags = 0;
4409 4409
4410 if (server->nfs_client->cl_minorversion)4410 if (nfs_server_capable(dir, NFS_CAP_MOVEABLE))
4411 task_flags = RPC_TASK_MOVEABLE;4411 task_flags = RPC_TASK_MOVEABLE;
4412 4412
4413 /* Is this is an attribute revalidation, subject to softreval? */4413 /* 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
6639 .rpc_client = server->client,6639 .rpc_client = server->client,
6640 .rpc_message = &msg,6640 .rpc_message = &msg,
6641 .callback_ops = &nfs4_delegreturn_ops,6641 .callback_ops = &nfs4_delegreturn_ops,
6642 .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT | RPC_TASK_MOVEABLE,6642 .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
6643 };6643 };
6644 int status = 0;6644 int status = 0;
6645 6645
6646 if (nfs_server_capable(inode, NFS_CAP_MOVEABLE))
6647 task_setup_data.flags |= RPC_TASK_MOVEABLE;
6648
6646 data = kzalloc(sizeof(*data), GFP_KERNEL);6649 data = kzalloc(sizeof(*data), GFP_KERNEL);
6647 if (data == NULL)6650 if (data == NULL)
6648 return -ENOMEM;6651 return -ENOMEM;
@@ -6956,10 +6959,8 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, · 307 unmodified lines
6956 .workqueue = nfsiod_workqueue,6959 .workqueue = nfsiod_workqueue,
6957 .flags = RPC_TASK_ASYNC,6960 .flags = RPC_TASK_ASYNC,
6958 };6961 };
6959 struct nfs_client *client =
6960 NFS_SERVER(lsp->ls_state->inode)->nfs_client;
6961 6962
6962 if (client->cl_minorversion)6963 if (nfs_server_capable(lsp->ls_state->inode, NFS_CAP_MOVEABLE))
6963 task_setup_data.flags |= RPC_TASK_MOVEABLE;6964 task_setup_data.flags |= RPC_TASK_MOVEABLE;
6964 6965
6965 nfs4_state_protect(NFS_SERVER(lsp->ls_state->inode)->nfs_client,6966 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
7230 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,7231 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
7231 };7232 };
7232 int ret;7233 int ret;
7233 struct nfs_client *client = NFS_SERVER(state->inode)->nfs_client;
7234 7234
7235 if (client->cl_minorversion)7235 if (nfs_server_capable(state->inode, NFS_CAP_MOVEABLE))
7236 task_setup_data.flags |= RPC_TASK_MOVEABLE;7236 task_setup_data.flags |= RPC_TASK_MOVEABLE;
7237 7237
7238 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file),7238 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
10467 | NFS_CAP_POSIX_LOCK10467 | NFS_CAP_POSIX_LOCK
10468 | NFS_CAP_STATEID_NFSV4110468 | NFS_CAP_STATEID_NFSV41
10469 | NFS_CAP_ATOMIC_OPEN_V110469 | NFS_CAP_ATOMIC_OPEN_V1
10470 | NFS_CAP_LGOPEN,10470 | NFS_CAP_LGOPEN
10471 | NFS_CAP_MOVEABLE,
10471 .init_client = nfs41_init_client,10472 .init_client = nfs41_init_client,
10472 .shutdown_client = nfs41_shutdown_client,10473 .shutdown_client = nfs41_shutdown_client,
10473 .match_stateid = nfs41_match_stateid,10474 .match_stateid = nfs41_match_stateid,
@@ -10502,7 +10503,8 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = { · 28 unmodified lines
10502 | NFS_CAP_LAYOUTSTATS10503 | NFS_CAP_LAYOUTSTATS
10503 | NFS_CAP_CLONE10504 | NFS_CAP_CLONE
10504 | NFS_CAP_LAYOUTERROR10505 | NFS_CAP_LAYOUTERROR
10505 | NFS_CAP_READ_PLUS,10506 | NFS_CAP_READ_PLUS
10507 | NFS_CAP_MOVEABLE,
10506 .init_client = nfs41_init_client,10508 .init_client = nfs41_init_client,
10507 .shutdown_client = nfs41_shutdown_client,10509 .shutdown_client = nfs41_shutdown_client,
10508 .match_stateid = nfs41_match_stateid,10510 .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
767 .flags = RPC_TASK_ASYNC | flags,767 .flags = RPC_TASK_ASYNC | flags,
768 };768 };
769 769
770 if (nfs_server_capable(hdr->inode, NFS_CAP_MOVEABLE))
771 task_setup_data.flags |= RPC_TASK_MOVEABLE;
772
770 hdr->rw_ops->rw_initiate(hdr, &msg, rpc_ops, &task_setup_data, how);773 hdr->rw_ops->rw_initiate(hdr, &msg, rpc_ops, &task_setup_data, how);
771 774
772 dprintk("NFS: initiated pgio call "775 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
102 };102 };
103 struct rpc_task *task;103 struct rpc_task *task;
104 struct inode *dir = d_inode(data->dentry->d_parent);104 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
105 nfs_sb_active(dir->i_sb);109 nfs_sb_active(dir->i_sb);
106 data->args.fh = NFS_FH(dir);110 data->args.fh = NFS_FH(dir);
107 nfs_fattr_init(data->res.dir_attr);111 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
344 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,348 .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
345 };349 };
346 350
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
347 data = kzalloc(sizeof(*data), GFP_KERNEL);355 data = kzalloc(sizeof(*data), GFP_KERNEL);
348 if (data == NULL)356 if (data == NULL)
349 return ERR_PTR(-ENOMEM);357 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
1709 .flags = RPC_TASK_ASYNC | flags,1709 .flags = RPC_TASK_ASYNC | flags,
1710 .priority = priority,1710 .priority = priority,
1711 };1711 };
1712
1713 if (nfs_server_capable(data->inode, NFS_CAP_MOVEABLE))
1714 task_setup_data.flags |= RPC_TASK_MOVEABLE;
1715
1712 /* Set up the initial task struct. */1716 /* Set up the initial task struct. */
1713 nfs_ops->commit_setup(data, &msg, &task_setup_data.rpc_client);1717 nfs_ops->commit_setup(data, &msg, &task_setup_data.rpc_client);
1714 trace_nfs_initiate_commit(data);1718 trace_nfs_initiate_commit(data);
include/linux/nfs_fs_sb.h+1−0
@@ -287,4 +287,5 @@ struct nfs_server { · 286 unmodified lines
287#define NFS_CAP_XATTR (1U << 28)287#define NFS_CAP_XATTR (1U << 28)
288#define NFS_CAP_READ_PLUS (1U << 29)288#define NFS_CAP_READ_PLUS (1U << 29)
289#define NFS_CAP_FS_LOCATIONS (1U << 30)289#define NFS_CAP_FS_LOCATIONS (1U << 30)
290#define NFS_CAP_MOVEABLE (1U << 31)
290#endif291#endif