You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'nfs-for-4.2-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust:
"Highlights include:
Stable patches:
- Fix a crash in the NFSv4 file locking code.
- Fix an fsync() regression, where we were failing to retry I/O in
some circumstances.
- Fix an infinite loop in NFSv4.0 OPEN stateid recovery
- Fix a memory leak when an attempted pnfs fails.
- Fix a memory leak in the backchannel code
- Large hostnames were not supported correctly in NFSv4.1
- Fix a pNFS/flexfiles bug that was impeding error reporting on I/O.
- Fix a couple of credential issues in pNFS/flexfiles
Bugfixes + cleanups:
- Open flag sanity checks in the NFSv4 atomic open codepath
- More NFSv4 delegation related bugfixes
- Various NFSv4.1 backchannel bugfixes and cleanups
- Fix the NFS swap socket code
- Various cleanups of the NFSv4 SETCLIENTID and EXCHANGE_ID code
- Fix a UDP transport deadlock issue
Features:
- More RDMA client transport improvements
- NFSv4.2 LAYOUTSTATS functionality for pnfs flexfiles"
* tag 'nfs-for-4.2-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (87 commits)
nfs: Remove invalid tk_pid from debug message
nfs: Remove invalid NFS_ATTR_FATTR_V4_REFERRAL checking in nfs4_get_rootfh
nfs: Drop bad comment in nfs41_walk_client_list()
nfs: Remove unneeded micro checking of CONFIG_PROC_FS
nfs: Don't setting FILE_CREATED flags always
nfs: Use remove_proc_subtree() instead remove_proc_entry()
nfs: Remove unused argument in nfs_server_set_fsinfo()
nfs: Fix a memory leak when meeting an unsupported state protect
nfs: take extra reference to fl->fl_file when running a LOCKU operation
NFSv4: When returning a delegation, don't reclaim an incompatible open mode.
NFSv4.2: LAYOUTSTATS is optional to implement
NFSv4.2: Fix up a decoding error in layoutstats
pNFS/flexfiles: Fix the reset of struct pgio_header when resending
pNFS/flexfiles: Turn off layoutcommit for servers that don't need it
pnfs/flexfiles: protect ktime manipulation with mirror lock
nfs: provide pnfs_report_layoutstat when NFS42 is disabled
nfs: verify open flags before allowing open
nfs: always update creds in mirror, even when we have an already connected ds
nfs: fix potential credential leak in ff_layout_update_mirror_cred
pnfs/flexfiles: report layoutstat regularly
...
This commit is contained in:
+3
-3
@@ -458,7 +458,7 @@ check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp)
|
||||
* pg_authenticate method for nfsv4 callback threads.
|
||||
*
|
||||
* The authflavor has been negotiated, so an incorrect flavor is a server
|
||||
* bug. Drop packets with incorrect authflavor.
|
||||
* bug. Deny packets with incorrect authflavor.
|
||||
*
|
||||
* All other checking done after NFS decoding where the nfs_client can be
|
||||
* found in nfs4_callback_compound
|
||||
@@ -468,12 +468,12 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)
|
||||
switch (rqstp->rq_authop->flavour) {
|
||||
case RPC_AUTH_NULL:
|
||||
if (rqstp->rq_proc != CB_NULL)
|
||||
return SVC_DROP;
|
||||
return SVC_DENIED;
|
||||
break;
|
||||
case RPC_AUTH_GSS:
|
||||
/* No RPC_AUTH_GSS support yet in NFSv4.1 */
|
||||
if (svc_is_backchannel(rqstp))
|
||||
return SVC_DROP;
|
||||
return SVC_DENIED;
|
||||
}
|
||||
return SVC_OK;
|
||||
}
|
||||
|
||||
+23
-15
@@ -327,10 +327,8 @@ validate_seqid(struct nfs4_slot_table *tbl, struct cb_sequenceargs * args)
|
||||
dprintk("%s slot table seqid: %u\n", __func__, slot->seq_nr);
|
||||
|
||||
/* Normal */
|
||||
if (likely(args->csa_sequenceid == slot->seq_nr + 1)) {
|
||||
slot->seq_nr++;
|
||||
if (likely(args->csa_sequenceid == slot->seq_nr + 1))
|
||||
goto out_ok;
|
||||
}
|
||||
|
||||
/* Replay */
|
||||
if (args->csa_sequenceid == slot->seq_nr) {
|
||||
@@ -418,6 +416,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
|
||||
struct cb_process_state *cps)
|
||||
{
|
||||
struct nfs4_slot_table *tbl;
|
||||
struct nfs4_slot *slot;
|
||||
struct nfs_client *clp;
|
||||
int i;
|
||||
__be32 status = htonl(NFS4ERR_BADSESSION);
|
||||
@@ -429,25 +428,32 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
|
||||
|
||||
if (!(clp->cl_session->flags & SESSION4_BACK_CHAN))
|
||||
goto out;
|
||||
|
||||
tbl = &clp->cl_session->bc_slot_table;
|
||||
slot = tbl->slots + args->csa_slotid;
|
||||
|
||||
spin_lock(&tbl->slot_tbl_lock);
|
||||
/* state manager is resetting the session */
|
||||
if (test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) {
|
||||
spin_unlock(&tbl->slot_tbl_lock);
|
||||
status = htonl(NFS4ERR_DELAY);
|
||||
/* Return NFS4ERR_BADSESSION if we're draining the session
|
||||
* in order to reset it.
|
||||
*/
|
||||
if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
|
||||
status = htonl(NFS4ERR_BADSESSION);
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
status = validate_seqid(&clp->cl_session->bc_slot_table, args);
|
||||
spin_unlock(&tbl->slot_tbl_lock);
|
||||
memcpy(&res->csr_sessionid, &args->csa_sessionid,
|
||||
sizeof(res->csr_sessionid));
|
||||
res->csr_sequenceid = args->csa_sequenceid;
|
||||
res->csr_slotid = args->csa_slotid;
|
||||
res->csr_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
|
||||
res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
|
||||
|
||||
status = validate_seqid(tbl, args);
|
||||
if (status)
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
|
||||
cps->slotid = args->csa_slotid;
|
||||
|
||||
@@ -458,15 +464,17 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
|
||||
*/
|
||||
if (referring_call_exists(clp, args->csa_nrclists, args->csa_rclists)) {
|
||||
status = htonl(NFS4ERR_DELAY);
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
memcpy(&res->csr_sessionid, &args->csa_sessionid,
|
||||
sizeof(res->csr_sessionid));
|
||||
res->csr_sequenceid = args->csa_sequenceid;
|
||||
res->csr_slotid = args->csa_slotid;
|
||||
res->csr_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
|
||||
res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
|
||||
/*
|
||||
* RFC5661 20.9.3
|
||||
* If CB_SEQUENCE returns an error, then the state of the slot
|
||||
* (sequence ID, cached reply) MUST NOT change.
|
||||
*/
|
||||
slot->seq_nr++;
|
||||
out_unlock:
|
||||
spin_unlock(&tbl->slot_tbl_lock);
|
||||
|
||||
out:
|
||||
cps->clp = clp; /* put in nfs4_callback_compound */
|
||||
|
||||
@@ -909,7 +909,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
|
||||
xdr_init_encode(&xdr_out, &rqstp->rq_res, p);
|
||||
|
||||
status = decode_compound_hdr_arg(&xdr_in, &hdr_arg);
|
||||
if (status == __constant_htonl(NFS4ERR_RESOURCE))
|
||||
if (status == htonl(NFS4ERR_RESOURCE))
|
||||
return rpc_garbage_args;
|
||||
|
||||
if (hdr_arg.minorversion == 0) {
|
||||
|
||||
+15
-25
@@ -825,7 +825,6 @@ error:
|
||||
* Load up the server record from information gained in an fsinfo record
|
||||
*/
|
||||
static void nfs_server_set_fsinfo(struct nfs_server *server,
|
||||
struct nfs_fh *mntfh,
|
||||
struct nfs_fsinfo *fsinfo)
|
||||
{
|
||||
unsigned long max_rpc_payload;
|
||||
@@ -901,7 +900,7 @@ int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs
|
||||
if (error < 0)
|
||||
goto out_error;
|
||||
|
||||
nfs_server_set_fsinfo(server, mntfh, &fsinfo);
|
||||
nfs_server_set_fsinfo(server, &fsinfo);
|
||||
|
||||
/* Get some general file system info */
|
||||
if (server->namelen == 0) {
|
||||
@@ -1193,8 +1192,6 @@ void nfs_clients_init(struct net *net)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static struct proc_dir_entry *proc_fs_nfs;
|
||||
|
||||
static int nfs_server_list_open(struct inode *inode, struct file *file);
|
||||
static void *nfs_server_list_start(struct seq_file *p, loff_t *pos);
|
||||
static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos);
|
||||
@@ -1364,27 +1361,29 @@ static int nfs_volume_list_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct nfs_server *server;
|
||||
struct nfs_client *clp;
|
||||
char dev[8], fsid[17];
|
||||
char dev[13]; // 8 for 2^24, 1 for ':', 3 for 2^8, 1 for '\0'
|
||||
char fsid[34]; // 2 * 16 for %llx, 1 for ':', 1 for '\0'
|
||||
struct nfs_net *nn = net_generic(seq_file_net(m), nfs_net_id);
|
||||
|
||||
/* display header on line 1 */
|
||||
if (v == &nn->nfs_volume_list) {
|
||||
seq_puts(m, "NV SERVER PORT DEV FSID FSC\n");
|
||||
seq_puts(m, "NV SERVER PORT DEV FSID"
|
||||
" FSC\n");
|
||||
return 0;
|
||||
}
|
||||
/* display one transport per line on subsequent lines */
|
||||
server = list_entry(v, struct nfs_server, master_link);
|
||||
clp = server->nfs_client;
|
||||
|
||||
snprintf(dev, 8, "%u:%u",
|
||||
snprintf(dev, sizeof(dev), "%u:%u",
|
||||
MAJOR(server->s_dev), MINOR(server->s_dev));
|
||||
|
||||
snprintf(fsid, 17, "%llx:%llx",
|
||||
snprintf(fsid, sizeof(fsid), "%llx:%llx",
|
||||
(unsigned long long) server->fsid.major,
|
||||
(unsigned long long) server->fsid.minor);
|
||||
|
||||
rcu_read_lock();
|
||||
seq_printf(m, "v%u %s %s %-7s %-17s %s\n",
|
||||
seq_printf(m, "v%u %s %s %-12s %-33s %s\n",
|
||||
clp->rpc_ops->version,
|
||||
rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
|
||||
rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT),
|
||||
@@ -1434,27 +1433,20 @@ void nfs_fs_proc_net_exit(struct net *net)
|
||||
*/
|
||||
int __init nfs_fs_proc_init(void)
|
||||
{
|
||||
struct proc_dir_entry *p;
|
||||
|
||||
proc_fs_nfs = proc_mkdir("fs/nfsfs", NULL);
|
||||
if (!proc_fs_nfs)
|
||||
if (!proc_mkdir("fs/nfsfs", NULL))
|
||||
goto error_0;
|
||||
|
||||
/* a file of servers with which we're dealing */
|
||||
p = proc_symlink("servers", proc_fs_nfs, "../../net/nfsfs/servers");
|
||||
if (!p)
|
||||
if (!proc_symlink("fs/nfsfs/servers", NULL, "../../net/nfsfs/servers"))
|
||||
goto error_1;
|
||||
|
||||
/* a file of volumes that we have mounted */
|
||||
p = proc_symlink("volumes", proc_fs_nfs, "../../net/nfsfs/volumes");
|
||||
if (!p)
|
||||
goto error_2;
|
||||
return 0;
|
||||
if (!proc_symlink("fs/nfsfs/volumes", NULL, "../../net/nfsfs/volumes"))
|
||||
goto error_1;
|
||||
|
||||
error_2:
|
||||
remove_proc_entry("servers", proc_fs_nfs);
|
||||
return 0;
|
||||
error_1:
|
||||
remove_proc_entry("fs/nfsfs", NULL);
|
||||
remove_proc_subtree("fs/nfsfs", NULL);
|
||||
error_0:
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -1464,9 +1456,7 @@ error_0:
|
||||
*/
|
||||
void nfs_fs_proc_exit(void)
|
||||
{
|
||||
remove_proc_entry("volumes", proc_fs_nfs);
|
||||
remove_proc_entry("servers", proc_fs_nfs);
|
||||
remove_proc_entry("fs/nfsfs", NULL);
|
||||
remove_proc_subtree("fs/nfsfs", NULL);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
@@ -1470,9 +1470,6 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((open_flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
|
||||
*opened |= FILE_CREATED;
|
||||
|
||||
err = finish_open(file, dentry, do_open, opened);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
+2
-13
@@ -555,31 +555,22 @@ static int nfs_launder_page(struct page *page)
|
||||
return nfs_wb_page(inode, page);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_SWAP
|
||||
static int nfs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
||||
sector_t *span)
|
||||
{
|
||||
int ret;
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
|
||||
|
||||
*span = sis->pages;
|
||||
|
||||
rcu_read_lock();
|
||||
ret = xs_swapper(rcu_dereference(clnt->cl_xprt), 1);
|
||||
rcu_read_unlock();
|
||||
|
||||
return ret;
|
||||
return rpc_clnt_swap_activate(clnt);
|
||||
}
|
||||
|
||||
static void nfs_swap_deactivate(struct file *file)
|
||||
{
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
|
||||
|
||||
rcu_read_lock();
|
||||
xs_swapper(rcu_dereference(clnt->cl_xprt), 0);
|
||||
rcu_read_unlock();
|
||||
rpc_clnt_swap_deactivate(clnt);
|
||||
}
|
||||
#endif
|
||||
|
||||
const struct address_space_operations nfs_file_aops = {
|
||||
.readpage = nfs_readpage,
|
||||
@@ -596,10 +587,8 @@ const struct address_space_operations nfs_file_aops = {
|
||||
.launder_page = nfs_launder_page,
|
||||
.is_dirty_writeback = nfs_check_dirty_writeback,
|
||||
.error_remove_page = generic_error_remove_page,
|
||||
#ifdef CONFIG_NFS_SWAP
|
||||
.swap_activate = nfs_swap_activate,
|
||||
.swap_deactivate = nfs_swap_deactivate,
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,17 @@
|
||||
#ifndef FS_NFS_NFS4FLEXFILELAYOUT_H
|
||||
#define FS_NFS_NFS4FLEXFILELAYOUT_H
|
||||
|
||||
#define FF_FLAGS_NO_LAYOUTCOMMIT 1
|
||||
|
||||
#include "../pnfs.h"
|
||||
|
||||
/* XXX: Let's filter out insanely large mirror count for now to avoid oom
|
||||
* due to network error etc. */
|
||||
#define NFS4_FLEXFILE_LAYOUT_MAX_MIRROR_CNT 4096
|
||||
|
||||
/* LAYOUTSTATS report interval in ms */
|
||||
#define FF_LAYOUTSTATS_REPORT_INTERVAL (60000L)
|
||||
|
||||
struct nfs4_ff_ds_version {
|
||||
u32 version;
|
||||
u32 minor_version;
|
||||
@@ -41,24 +46,48 @@ struct nfs4_ff_layout_ds_err {
|
||||
struct nfs4_deviceid deviceid;
|
||||
};
|
||||
|
||||
struct nfs4_ff_io_stat {
|
||||
__u64 ops_requested;
|
||||
__u64 bytes_requested;
|
||||
__u64 ops_completed;
|
||||
__u64 bytes_completed;
|
||||
__u64 bytes_not_delivered;
|
||||
ktime_t total_busy_time;
|
||||
ktime_t aggregate_completion_time;
|
||||
};
|
||||
|
||||
struct nfs4_ff_busy_timer {
|
||||
ktime_t start_time;
|
||||
atomic_t n_ops;
|
||||
};
|
||||
|
||||
struct nfs4_ff_layoutstat {
|
||||
struct nfs4_ff_io_stat io_stat;
|
||||
struct nfs4_ff_busy_timer busy_timer;
|
||||
};
|
||||
|
||||
struct nfs4_ff_layout_mirror {
|
||||
struct pnfs_layout_segment *lseg; /* back pointer */
|
||||
u32 ds_count;
|
||||
u32 efficiency;
|
||||
struct nfs4_ff_layout_ds *mirror_ds;
|
||||
u32 fh_versions_cnt;
|
||||
struct nfs_fh *fh_versions;
|
||||
nfs4_stateid stateid;
|
||||
struct nfs4_string user_name;
|
||||
struct nfs4_string group_name;
|
||||
u32 uid;
|
||||
u32 gid;
|
||||
struct rpc_cred *cred;
|
||||
spinlock_t lock;
|
||||
struct nfs4_ff_layoutstat read_stat;
|
||||
struct nfs4_ff_layoutstat write_stat;
|
||||
ktime_t start_time;
|
||||
ktime_t last_report_time;
|
||||
};
|
||||
|
||||
struct nfs4_ff_layout_segment {
|
||||
struct pnfs_layout_segment generic_hdr;
|
||||
u64 stripe_unit;
|
||||
u32 flags;
|
||||
u32 mirror_array_cnt;
|
||||
struct nfs4_ff_layout_mirror **mirror_array;
|
||||
};
|
||||
|
||||
@@ -324,7 +324,8 @@ static int ff_layout_update_mirror_cred(struct nfs4_ff_layout_mirror *mirror,
|
||||
__func__, PTR_ERR(cred));
|
||||
return PTR_ERR(cred);
|
||||
} else {
|
||||
mirror->cred = cred;
|
||||
if (cmpxchg(&mirror->cred, NULL, cred))
|
||||
put_rpccred(cred);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -386,7 +387,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
||||
/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */
|
||||
smp_rmb();
|
||||
if (ds->ds_clp)
|
||||
goto out;
|
||||
goto out_update_creds;
|
||||
|
||||
flavor = nfs4_ff_layout_choose_authflavor(mirror);
|
||||
|
||||
@@ -430,7 +431,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out_update_creds:
|
||||
if (ff_layout_update_mirror_cred(mirror, ds))
|
||||
ds = NULL;
|
||||
out:
|
||||
|
||||
+5
-7
@@ -678,6 +678,8 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
|
||||
if (!err) {
|
||||
generic_fillattr(inode, stat);
|
||||
stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
stat->blksize = NFS_SERVER(inode)->dtsize;
|
||||
}
|
||||
out:
|
||||
trace_nfs_getattr_exit(inode, err);
|
||||
@@ -2008,17 +2010,15 @@ static int __init init_nfs_fs(void)
|
||||
if (err)
|
||||
goto out1;
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
rpc_proc_register(&init_net, &nfs_rpcstat);
|
||||
#endif
|
||||
if ((err = register_nfs_fs()) != 0)
|
||||
|
||||
err = register_nfs_fs();
|
||||
if (err)
|
||||
goto out0;
|
||||
|
||||
return 0;
|
||||
out0:
|
||||
#ifdef CONFIG_PROC_FS
|
||||
rpc_proc_unregister(&init_net, "nfs");
|
||||
#endif
|
||||
nfs_destroy_directcache();
|
||||
out1:
|
||||
nfs_destroy_writepagecache();
|
||||
@@ -2049,9 +2049,7 @@ static void __exit exit_nfs_fs(void)
|
||||
nfs_destroy_nfspagecache();
|
||||
nfs_fscache_unregister();
|
||||
unregister_pernet_subsys(&nfs_net_ops);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
rpc_proc_unregister(&init_net, "nfs");
|
||||
#endif
|
||||
unregister_nfs_fs();
|
||||
nfs_fs_proc_exit();
|
||||
nfsiod_stop();
|
||||
|
||||
+1
-1
@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
|
||||
if (args->npages != 0)
|
||||
xdr_write_pages(xdr, args->pages, 0, args->len);
|
||||
else
|
||||
xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE);
|
||||
xdr_reserve_space(xdr, args->len);
|
||||
|
||||
error = nfsacl_encode(xdr->buf, base, args->inode,
|
||||
(args->mask & NFS_ACL) ?
|
||||
|
||||
+8
-1
@@ -5,11 +5,18 @@
|
||||
#ifndef __LINUX_FS_NFS_NFS4_2_H
|
||||
#define __LINUX_FS_NFS_NFS4_2_H
|
||||
|
||||
/*
|
||||
* FIXME: four LAYOUTSTATS calls per compound at most! Do we need to support
|
||||
* more? Need to consider not to pre-alloc too much for a compound.
|
||||
*/
|
||||
#define PNFS_LAYOUTSTATS_MAXDEV (4)
|
||||
|
||||
/* nfs4.2proc.c */
|
||||
int nfs42_proc_allocate(struct file *, loff_t, loff_t);
|
||||
int nfs42_proc_deallocate(struct file *, loff_t, loff_t);
|
||||
loff_t nfs42_proc_llseek(struct file *, loff_t, int);
|
||||
|
||||
int nfs42_proc_layoutstats_generic(struct nfs_server *,
|
||||
struct nfs42_layoutstat_data *);
|
||||
/* nfs4.2xdr.h */
|
||||
extern struct rpc_procinfo nfs4_2_procedures[];
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
#include <linux/nfs_fs.h>
|
||||
#include "nfs4_fs.h"
|
||||
#include "nfs42.h"
|
||||
#include "iostat.h"
|
||||
#include "pnfs.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define NFSDBG_FACILITY NFSDBG_PNFS
|
||||
|
||||
static int nfs42_set_rw_stateid(nfs4_stateid *dst, struct file *file,
|
||||
fmode_t fmode)
|
||||
@@ -165,3 +170,85 @@ loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
|
||||
|
||||
return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes);
|
||||
}
|
||||
|
||||
static void
|
||||
nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
|
||||
{
|
||||
struct nfs42_layoutstat_data *data = calldata;
|
||||
struct nfs_server *server = NFS_SERVER(data->args.inode);
|
||||
|
||||
nfs41_setup_sequence(nfs4_get_session(server), &data->args.seq_args,
|
||||
&data->res.seq_res, task);
|
||||
}
|
||||
|
||||
static void
|
||||
nfs42_layoutstat_done(struct rpc_task *task, void *calldata)
|
||||
{
|
||||
struct nfs42_layoutstat_data *data = calldata;
|
||||
|
||||
if (!nfs4_sequence_done(task, &data->res.seq_res))
|
||||
return;
|
||||
|
||||
switch (task->tk_status) {
|
||||
case 0:
|
||||
break;
|
||||
case -ENOTSUPP:
|
||||
case -EOPNOTSUPP:
|
||||
NFS_SERVER(data->inode)->caps &= ~NFS_CAP_LAYOUTSTATS;
|
||||
default:
|
||||
dprintk("%s server returns %d\n", __func__, task->tk_status);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nfs42_layoutstat_release(void *calldata)
|
||||
{
|
||||
struct nfs42_layoutstat_data *data = calldata;
|
||||
struct nfs_server *nfss = NFS_SERVER(data->args.inode);
|
||||
|
||||
if (nfss->pnfs_curr_ld->cleanup_layoutstats)
|
||||
nfss->pnfs_curr_ld->cleanup_layoutstats(data);
|
||||
|
||||
pnfs_put_layout_hdr(NFS_I(data->args.inode)->layout);
|
||||
smp_mb__before_atomic();
|
||||
clear_bit(NFS_INO_LAYOUTSTATS, &NFS_I(data->args.inode)->flags);
|
||||
smp_mb__after_atomic();
|
||||
nfs_iput_and_deactive(data->inode);
|
||||
kfree(data->args.devinfo);
|
||||
kfree(data);
|
||||
}
|
||||
|
||||
static const struct rpc_call_ops nfs42_layoutstat_ops = {
|
||||
.rpc_call_prepare = nfs42_layoutstat_prepare,
|
||||
.rpc_call_done = nfs42_layoutstat_done,
|
||||
.rpc_release = nfs42_layoutstat_release,
|
||||
};
|
||||
|
||||
int nfs42_proc_layoutstats_generic(struct nfs_server *server,
|
||||
struct nfs42_layoutstat_data *data)
|
||||
{
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LAYOUTSTATS],
|
||||
.rpc_argp = &data->args,
|
||||
.rpc_resp = &data->res,
|
||||
};
|
||||
struct rpc_task_setup task_setup = {
|
||||
.rpc_client = server->client,
|
||||
.rpc_message = &msg,
|
||||
.callback_ops = &nfs42_layoutstat_ops,
|
||||
.callback_data = data,
|
||||
.flags = RPC_TASK_ASYNC,
|
||||
};
|
||||
struct rpc_task *task;
|
||||
|
||||
data->inode = nfs_igrab_and_active(data->args.inode);
|
||||
if (!data->inode) {
|
||||
nfs42_layoutstat_release(data);
|
||||
return -EAGAIN;
|
||||
}
|
||||
nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0);
|
||||
task = rpc_run_task(&task_setup);
|
||||
if (IS_ERR(task))
|
||||
return PTR_ERR(task);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#ifndef __LINUX_FS_NFS_NFS4_2XDR_H
|
||||
#define __LINUX_FS_NFS_NFS4_2XDR_H
|
||||
|
||||
#include "nfs42.h"
|
||||
|
||||
#define encode_fallocate_maxsz (encode_stateid_maxsz + \
|
||||
2 /* offset */ + \
|
||||
2 /* length */)
|
||||
@@ -22,6 +24,16 @@
|
||||
1 /* whence */ + \
|
||||
2 /* offset */ + \
|
||||
2 /* length */)
|
||||
#define encode_io_info_maxsz 4
|
||||
#define encode_layoutstats_maxsz (op_decode_hdr_maxsz + \
|
||||
2 /* offset */ + \
|
||||
2 /* length */ + \
|
||||
encode_stateid_maxsz + \
|
||||
encode_io_info_maxsz + \
|
||||
encode_io_info_maxsz + \
|
||||
1 /* opaque devaddr4 length */ + \
|
||||
XDR_QUADLEN(PNFS_LAYOUTSTATS_MAXSIZE))
|
||||
#define decode_layoutstats_maxsz (op_decode_hdr_maxsz)
|
||||
|
||||
#define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \
|
||||
encode_putfh_maxsz + \
|
||||
@@ -45,6 +57,14 @@
|
||||
#define NFS4_dec_seek_sz (compound_decode_hdr_maxsz + \
|
||||
decode_putfh_maxsz + \
|
||||
decode_seek_maxsz)
|
||||
#define NFS4_enc_layoutstats_sz (compound_encode_hdr_maxsz + \
|
||||
encode_sequence_maxsz + \
|
||||
encode_putfh_maxsz + \
|
||||
PNFS_LAYOUTSTATS_MAXDEV * encode_layoutstats_maxsz)
|
||||
#define NFS4_dec_layoutstats_sz (compound_decode_hdr_maxsz + \
|
||||
decode_sequence_maxsz + \
|
||||
decode_putfh_maxsz + \
|
||||
PNFS_LAYOUTSTATS_MAXDEV * decode_layoutstats_maxsz)
|
||||
|
||||
|
||||
static void encode_fallocate(struct xdr_stream *xdr,
|
||||
@@ -81,6 +101,33 @@ static void encode_seek(struct xdr_stream *xdr,
|
||||
encode_uint32(xdr, args->sa_what);
|
||||
}
|
||||
|
||||
static void encode_layoutstats(struct xdr_stream *xdr,
|
||||
struct nfs42_layoutstat_args *args,
|
||||
struct nfs42_layoutstat_devinfo *devinfo,
|
||||
struct compound_hdr *hdr)
|
||||
{
|
||||
__be32 *p;
|
||||
|
||||
encode_op_hdr(xdr, OP_LAYOUTSTATS, decode_layoutstats_maxsz, hdr);
|
||||
p = reserve_space(xdr, 8 + 8);
|
||||
p = xdr_encode_hyper(p, devinfo->offset);
|
||||
p = xdr_encode_hyper(p, devinfo->length);
|
||||
encode_nfs4_stateid(xdr, &args->stateid);
|
||||
p = reserve_space(xdr, 4*8 + NFS4_DEVICEID4_SIZE + 4);
|
||||
p = xdr_encode_hyper(p, devinfo->read_count);
|
||||
p = xdr_encode_hyper(p, devinfo->read_bytes);
|
||||
p = xdr_encode_hyper(p, devinfo->write_count);
|
||||
p = xdr_encode_hyper(p, devinfo->write_bytes);
|
||||
p = xdr_encode_opaque_fixed(p, devinfo->dev_id.data,
|
||||
NFS4_DEVICEID4_SIZE);
|
||||
/* Encode layoutupdate4 */
|
||||
*p++ = cpu_to_be32(devinfo->layout_type);
|
||||
if (devinfo->layoutstats_encode != NULL)
|
||||
devinfo->layoutstats_encode(xdr, args, devinfo);
|
||||
else
|
||||
encode_uint32(xdr, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode ALLOCATE request
|
||||
*/
|
||||
@@ -137,6 +184,28 @@ static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
|
||||
encode_nops(&hdr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode LAYOUTSTATS request
|
||||
*/
|
||||
static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
|
||||
struct xdr_stream *xdr,
|
||||
struct nfs42_layoutstat_args *args)
|
||||
{
|
||||
int i;
|
||||
|
||||
struct compound_hdr hdr = {
|
||||
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
|
||||
};
|
||||
|
||||
encode_compound_hdr(xdr, req, &hdr);
|
||||
encode_sequence(xdr, &args->seq_args, &hdr);
|
||||
encode_putfh(xdr, args->fh, &hdr);
|
||||
WARN_ON(args->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
|
||||
for (i = 0; i < args->num_dev; i++)
|
||||
encode_layoutstats(xdr, args, &args->devinfo[i], &hdr);
|
||||
encode_nops(&hdr);
|
||||
}
|
||||
|
||||
static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
|
||||
{
|
||||
return decode_op_hdr(xdr, OP_ALLOCATE);
|
||||
@@ -169,6 +238,12 @@ out_overflow:
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int decode_layoutstats(struct xdr_stream *xdr,
|
||||
struct nfs42_layoutstat_res *res)
|
||||
{
|
||||
return decode_op_hdr(xdr, OP_LAYOUTSTATS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode ALLOCATE request
|
||||
*/
|
||||
@@ -246,4 +321,35 @@ static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode LAYOUTSTATS request
|
||||
*/
|
||||
static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
|
||||
struct xdr_stream *xdr,
|
||||
struct nfs42_layoutstat_res *res)
|
||||
{
|
||||
struct compound_hdr hdr;
|
||||
int status, i;
|
||||
|
||||
status = decode_compound_hdr(xdr, &hdr);
|
||||
if (status)
|
||||
goto out;
|
||||
status = decode_sequence(xdr, &res->seq_res, rqstp);
|
||||
if (status)
|
||||
goto out;
|
||||
status = decode_putfh(xdr);
|
||||
if (status)
|
||||
goto out;
|
||||
WARN_ON(res->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
|
||||
for (i = 0; i < res->num_dev; i++) {
|
||||
status = decode_layoutstats(xdr, res);
|
||||
if (status)
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
res->rpc_status = status;
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif /* __LINUX_FS_NFS_NFS4_2XDR_H */
|
||||
|
||||
@@ -233,6 +233,7 @@ extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception
|
||||
extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
|
||||
struct rpc_message *, struct nfs4_sequence_args *,
|
||||
struct nfs4_sequence_res *, int);
|
||||
extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int);
|
||||
extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *);
|
||||
extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *);
|
||||
extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *, bool);
|
||||
|
||||
@@ -676,7 +676,6 @@ found:
|
||||
break;
|
||||
}
|
||||
|
||||
/* No matching nfs_client found. */
|
||||
spin_unlock(&nn->nfs_client_lock);
|
||||
dprintk("NFS: <-- %s status = %d\n", __func__, status);
|
||||
nfs_put_client(prev);
|
||||
|
||||
@@ -41,6 +41,10 @@ nfs4_file_open(struct inode *inode, struct file *filp)
|
||||
|
||||
dprintk("NFS: open file(%pd2)\n", dentry);
|
||||
|
||||
err = nfs_check_flags(openflags);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if ((openflags & O_ACCMODE) == 3)
|
||||
openflags--;
|
||||
|
||||
|
||||
@@ -35,13 +35,6 @@ int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool auth_p
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fsinfo.fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) {
|
||||
printk(KERN_ERR "nfs4_get_rootfh:"
|
||||
" getroot obtained referral\n");
|
||||
ret = -EREMOTE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(&server->fsid, &fsinfo.fattr->fsid, sizeof(server->fsid));
|
||||
out:
|
||||
nfs_free_fattr(fsinfo.fattr);
|
||||
|
||||
+1
-6
@@ -494,12 +494,7 @@ nfs_idmap_delete(struct nfs_client *clp)
|
||||
|
||||
int nfs_idmap_init(void)
|
||||
{
|
||||
int ret;
|
||||
ret = nfs_idmap_init_keyring();
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
out:
|
||||
return ret;
|
||||
return nfs_idmap_init_keyring();
|
||||
}
|
||||
|
||||
void nfs_idmap_quit(void)
|
||||
|
||||
+155
-66
@@ -356,6 +356,9 @@ int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_
|
||||
case 0:
|
||||
return 0;
|
||||
case -NFS4ERR_OPENMODE:
|
||||
case -NFS4ERR_DELEG_REVOKED:
|
||||
case -NFS4ERR_ADMIN_REVOKED:
|
||||
case -NFS4ERR_BAD_STATEID:
|
||||
if (inode && nfs4_have_delegation(inode, FMODE_READ)) {
|
||||
nfs4_inode_return_delegation(inode);
|
||||
exception->retry = 1;
|
||||
@@ -367,15 +370,6 @@ int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_
|
||||
if (ret < 0)
|
||||
break;
|
||||
goto wait_on_recovery;
|
||||
case -NFS4ERR_DELEG_REVOKED:
|
||||
case -NFS4ERR_ADMIN_REVOKED:
|
||||
case -NFS4ERR_BAD_STATEID:
|
||||
if (state == NULL)
|
||||
break;
|
||||
ret = nfs4_schedule_stateid_recovery(server, state);
|
||||
if (ret < 0)
|
||||
break;
|
||||
goto wait_on_recovery;
|
||||
case -NFS4ERR_EXPIRED:
|
||||
if (state != NULL) {
|
||||
ret = nfs4_schedule_stateid_recovery(server, state);
|
||||
@@ -482,8 +476,8 @@ struct nfs4_call_sync_data {
|
||||
struct nfs4_sequence_res *seq_res;
|
||||
};
|
||||
|
||||
static void nfs4_init_sequence(struct nfs4_sequence_args *args,
|
||||
struct nfs4_sequence_res *res, int cache_reply)
|
||||
void nfs4_init_sequence(struct nfs4_sequence_args *args,
|
||||
struct nfs4_sequence_res *res, int cache_reply)
|
||||
{
|
||||
args->sa_slot = NULL;
|
||||
args->sa_cache_this = cache_reply;
|
||||
@@ -1553,6 +1547,13 @@ static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, fmode_t fmod
|
||||
struct nfs4_state *newstate;
|
||||
int ret;
|
||||
|
||||
if ((opendata->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR ||
|
||||
opendata->o_arg.claim == NFS4_OPEN_CLAIM_DELEG_CUR_FH) &&
|
||||
(opendata->o_arg.u.delegation_type & fmode) != fmode)
|
||||
/* This mode can't have been delegated, so we must have
|
||||
* a valid open_stateid to cover it - not need to reclaim.
|
||||
*/
|
||||
return 0;
|
||||
opendata->o_arg.open_flags = 0;
|
||||
opendata->o_arg.fmode = fmode;
|
||||
opendata->o_arg.share_access = nfs4_map_atomic_open_share(
|
||||
@@ -1684,6 +1685,7 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct
|
||||
"%d.\n", __func__, err);
|
||||
case 0:
|
||||
case -ENOENT:
|
||||
case -EAGAIN:
|
||||
case -ESTALE:
|
||||
break;
|
||||
case -NFS4ERR_BADSESSION:
|
||||
@@ -3355,6 +3357,8 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
|
||||
goto out;
|
||||
case -NFS4ERR_MOVED:
|
||||
err = nfs4_get_referral(client, dir, name, fattr, fhandle);
|
||||
if (err == -NFS4ERR_MOVED)
|
||||
err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception);
|
||||
goto out;
|
||||
case -NFS4ERR_WRONGSEC:
|
||||
err = -EPERM;
|
||||
@@ -4955,49 +4959,128 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp,
|
||||
memcpy(bootverf->data, verf, sizeof(bootverf->data));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
nfs4_init_nonuniform_client_string(struct nfs_client *clp,
|
||||
char *buf, size_t len)
|
||||
static int
|
||||
nfs4_init_nonuniform_client_string(struct nfs_client *clp)
|
||||
{
|
||||
unsigned int result;
|
||||
int result;
|
||||
size_t len;
|
||||
char *str;
|
||||
bool retried = false;
|
||||
|
||||
if (clp->cl_owner_id != NULL)
|
||||
return strlcpy(buf, clp->cl_owner_id, len);
|
||||
return 0;
|
||||
retry:
|
||||
rcu_read_lock();
|
||||
len = 10 + strlen(clp->cl_ipaddr) + 1 +
|
||||
strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)) +
|
||||
1 +
|
||||
strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_PROTO)) +
|
||||
1;
|
||||
rcu_read_unlock();
|
||||
|
||||
if (len > NFS4_OPAQUE_LIMIT + 1)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Since this string is allocated at mount time, and held until the
|
||||
* nfs_client is destroyed, we can use GFP_KERNEL here w/o worrying
|
||||
* about a memory-reclaim deadlock.
|
||||
*/
|
||||
str = kmalloc(len, GFP_KERNEL);
|
||||
if (!str)
|
||||
return -ENOMEM;
|
||||
|
||||
rcu_read_lock();
|
||||
result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s",
|
||||
clp->cl_ipaddr,
|
||||
rpc_peeraddr2str(clp->cl_rpcclient,
|
||||
RPC_DISPLAY_ADDR),
|
||||
rpc_peeraddr2str(clp->cl_rpcclient,
|
||||
RPC_DISPLAY_PROTO));
|
||||
result = scnprintf(str, len, "Linux NFSv4.0 %s/%s %s",
|
||||
clp->cl_ipaddr,
|
||||
rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR),
|
||||
rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_PROTO));
|
||||
rcu_read_unlock();
|
||||
clp->cl_owner_id = kstrdup(buf, GFP_KERNEL);
|
||||
return result;
|
||||
|
||||
/* Did something change? */
|
||||
if (result >= len) {
|
||||
kfree(str);
|
||||
if (retried)
|
||||
return -EINVAL;
|
||||
retried = true;
|
||||
goto retry;
|
||||
}
|
||||
clp->cl_owner_id = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
nfs4_init_uniform_client_string(struct nfs_client *clp,
|
||||
char *buf, size_t len)
|
||||
static int
|
||||
nfs4_init_uniquifier_client_string(struct nfs_client *clp)
|
||||
{
|
||||
const char *nodename = clp->cl_rpcclient->cl_nodename;
|
||||
unsigned int result;
|
||||
int result;
|
||||
size_t len;
|
||||
char *str;
|
||||
|
||||
len = 10 + 10 + 1 + 10 + 1 +
|
||||
strlen(nfs4_client_id_uniquifier) + 1 +
|
||||
strlen(clp->cl_rpcclient->cl_nodename) + 1;
|
||||
|
||||
if (len > NFS4_OPAQUE_LIMIT + 1)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Since this string is allocated at mount time, and held until the
|
||||
* nfs_client is destroyed, we can use GFP_KERNEL here w/o worrying
|
||||
* about a memory-reclaim deadlock.
|
||||
*/
|
||||
str = kmalloc(len, GFP_KERNEL);
|
||||
if (!str)
|
||||
return -ENOMEM;
|
||||
|
||||
result = scnprintf(str, len, "Linux NFSv%u.%u %s/%s",
|
||||
clp->rpc_ops->version, clp->cl_minorversion,
|
||||
nfs4_client_id_uniquifier,
|
||||
clp->cl_rpcclient->cl_nodename);
|
||||
if (result >= len) {
|
||||
kfree(str);
|
||||
return -EINVAL;
|
||||
}
|
||||
clp->cl_owner_id = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nfs4_init_uniform_client_string(struct nfs_client *clp)
|
||||
{
|
||||
int result;
|
||||
size_t len;
|
||||
char *str;
|
||||
|
||||
if (clp->cl_owner_id != NULL)
|
||||
return strlcpy(buf, clp->cl_owner_id, len);
|
||||
return 0;
|
||||
|
||||
if (nfs4_client_id_uniquifier[0] != '\0')
|
||||
result = scnprintf(buf, len, "Linux NFSv%u.%u %s/%s",
|
||||
clp->rpc_ops->version,
|
||||
clp->cl_minorversion,
|
||||
nfs4_client_id_uniquifier,
|
||||
nodename);
|
||||
else
|
||||
result = scnprintf(buf, len, "Linux NFSv%u.%u %s",
|
||||
clp->rpc_ops->version, clp->cl_minorversion,
|
||||
nodename);
|
||||
clp->cl_owner_id = kstrdup(buf, GFP_KERNEL);
|
||||
return result;
|
||||
return nfs4_init_uniquifier_client_string(clp);
|
||||
|
||||
len = 10 + 10 + 1 + 10 + 1 +
|
||||
strlen(clp->cl_rpcclient->cl_nodename) + 1;
|
||||
|
||||
if (len > NFS4_OPAQUE_LIMIT + 1)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Since this string is allocated at mount time, and held until the
|
||||
* nfs_client is destroyed, we can use GFP_KERNEL here w/o worrying
|
||||
* about a memory-reclaim deadlock.
|
||||
*/
|
||||
str = kmalloc(len, GFP_KERNEL);
|
||||
if (!str)
|
||||
return -ENOMEM;
|
||||
|
||||
result = scnprintf(str, len, "Linux NFSv%u.%u %s",
|
||||
clp->rpc_ops->version, clp->cl_minorversion,
|
||||
clp->cl_rpcclient->cl_nodename);
|
||||
if (result >= len) {
|
||||
kfree(str);
|
||||
return -EINVAL;
|
||||
}
|
||||
clp->cl_owner_id = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5044,7 +5127,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
|
||||
struct nfs4_setclientid setclientid = {
|
||||
.sc_verifier = &sc_verifier,
|
||||
.sc_prog = program,
|
||||
.sc_cb_ident = clp->cl_cb_ident,
|
||||
.sc_clnt = clp,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETCLIENTID],
|
||||
@@ -5064,16 +5147,15 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
|
||||
|
||||
/* nfs_client_id4 */
|
||||
nfs4_init_boot_verifier(clp, &sc_verifier);
|
||||
|
||||
if (test_bit(NFS_CS_MIGRATION, &clp->cl_flags))
|
||||
setclientid.sc_name_len =
|
||||
nfs4_init_uniform_client_string(clp,
|
||||
setclientid.sc_name,
|
||||
sizeof(setclientid.sc_name));
|
||||
status = nfs4_init_uniform_client_string(clp);
|
||||
else
|
||||
setclientid.sc_name_len =
|
||||
nfs4_init_nonuniform_client_string(clp,
|
||||
setclientid.sc_name,
|
||||
sizeof(setclientid.sc_name));
|
||||
status = nfs4_init_nonuniform_client_string(clp);
|
||||
|
||||
if (status)
|
||||
goto out;
|
||||
|
||||
/* cb_client4 */
|
||||
setclientid.sc_netid_len =
|
||||
nfs4_init_callback_netid(clp,
|
||||
@@ -5083,9 +5165,9 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
|
||||
sizeof(setclientid.sc_uaddr), "%s.%u.%u",
|
||||
clp->cl_ipaddr, port >> 8, port & 255);
|
||||
|
||||
dprintk("NFS call setclientid auth=%s, '%.*s'\n",
|
||||
dprintk("NFS call setclientid auth=%s, '%s'\n",
|
||||
clp->cl_rpcclient->cl_auth->au_ops->au_name,
|
||||
setclientid.sc_name_len, setclientid.sc_name);
|
||||
clp->cl_owner_id);
|
||||
task = rpc_run_task(&task_setup_data);
|
||||
if (IS_ERR(task)) {
|
||||
status = PTR_ERR(task);
|
||||
@@ -5402,6 +5484,7 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,
|
||||
atomic_inc(&lsp->ls_count);
|
||||
/* Ensure we don't close file until we're done freeing locks! */
|
||||
p->ctx = get_nfs_open_context(ctx);
|
||||
get_file(fl->fl_file);
|
||||
memcpy(&p->fl, fl, sizeof(p->fl));
|
||||
p->server = NFS_SERVER(inode);
|
||||
return p;
|
||||
@@ -5413,6 +5496,7 @@ static void nfs4_locku_release_calldata(void *data)
|
||||
nfs_free_seqid(calldata->arg.seqid);
|
||||
nfs4_put_lock_state(calldata->lsp);
|
||||
put_nfs_open_context(calldata->ctx);
|
||||
fput(calldata->fl.fl_file);
|
||||
kfree(calldata);
|
||||
}
|
||||
|
||||
@@ -6846,11 +6930,14 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
|
||||
};
|
||||
|
||||
nfs4_init_boot_verifier(clp, &verifier);
|
||||
args.id_len = nfs4_init_uniform_client_string(clp, args.id,
|
||||
sizeof(args.id));
|
||||
dprintk("NFS call exchange_id auth=%s, '%.*s'\n",
|
||||
|
||||
status = nfs4_init_uniform_client_string(clp);
|
||||
if (status)
|
||||
goto out;
|
||||
|
||||
dprintk("NFS call exchange_id auth=%s, '%s'\n",
|
||||
clp->cl_rpcclient->cl_auth->au_ops->au_name,
|
||||
args.id_len, args.id);
|
||||
clp->cl_owner_id);
|
||||
|
||||
res.server_owner = kzalloc(sizeof(struct nfs41_server_owner),
|
||||
GFP_NOFS);
|
||||
@@ -6885,7 +6972,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
|
||||
/* unsupported! */
|
||||
WARN_ON_ONCE(1);
|
||||
status = -EINVAL;
|
||||
goto out_server_scope;
|
||||
goto out_impl_id;
|
||||
}
|
||||
|
||||
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||
@@ -6913,6 +7000,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
|
||||
/* use the most recent implementation id */
|
||||
kfree(clp->cl_implid);
|
||||
clp->cl_implid = res.impl_id;
|
||||
res.impl_id = NULL;
|
||||
|
||||
if (clp->cl_serverscope != NULL &&
|
||||
!nfs41_same_server_scope(clp->cl_serverscope,
|
||||
@@ -6926,15 +7014,16 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
|
||||
|
||||
if (clp->cl_serverscope == NULL) {
|
||||
clp->cl_serverscope = res.server_scope;
|
||||
goto out;
|
||||
res.server_scope = NULL;
|
||||
}
|
||||
} else
|
||||
kfree(res.impl_id);
|
||||
}
|
||||
|
||||
out_server_owner:
|
||||
kfree(res.server_owner);
|
||||
out_impl_id:
|
||||
kfree(res.impl_id);
|
||||
out_server_scope:
|
||||
kfree(res.server_scope);
|
||||
out_server_owner:
|
||||
kfree(res.server_owner);
|
||||
out:
|
||||
if (clp->cl_implid != NULL)
|
||||
dprintk("NFS reply exchange_id: Server Implementation ID: "
|
||||
@@ -8061,9 +8150,8 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)
|
||||
struct rpc_task *task;
|
||||
int status = 0;
|
||||
|
||||
dprintk("NFS: %4d initiating layoutcommit call. sync %d "
|
||||
"lbw: %llu inode %lu\n",
|
||||
data->task.tk_pid, sync,
|
||||
dprintk("NFS: initiating layoutcommit call. sync %d "
|
||||
"lbw: %llu inode %lu\n", sync,
|
||||
data->args.lastbytewritten,
|
||||
data->args.inode->i_ino);
|
||||
|
||||
@@ -8557,7 +8645,8 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
|
||||
| NFS_CAP_ATOMIC_OPEN_V1
|
||||
| NFS_CAP_ALLOCATE
|
||||
| NFS_CAP_DEALLOCATE
|
||||
| NFS_CAP_SEEK,
|
||||
| NFS_CAP_SEEK
|
||||
| NFS_CAP_LAYOUTSTATS,
|
||||
.init_client = nfs41_init_client,
|
||||
.shutdown_client = nfs41_shutdown_client,
|
||||
.match_stateid = nfs41_match_stateid,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user