Merge branch 'for-3.2' of git://linux-nfs.org/~bfields/linux
* 'for-3.2' of git://linux-nfs.org/~bfields/linux: (103 commits) nfs41: implement DESTROY_CLIENTID operation nfsd4: typo logical vs bitwise negate for want_mask nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED nfsd4: seq->status_flags may be used unitialized nfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid nfsd4: implement new 4.1 open reclaim types nfsd4: remove unneeded CLAIM_DELEGATE_CUR workaround nfsd4: warn on open failure after create nfsd4: preallocate open stateid in process_open1() nfsd4: do idr preallocation with stateid allocation nfsd4: preallocate nfs4_file in process_open1() nfsd4: clean up open owners on OPEN failure nfsd4: simplify process_open1 logic nfsd4: make is_open_owner boolean nfsd4: centralize renew_client() calls nfsd4: typo logical vs bitwise negate nfs: fix bug about IPv6 address scope checking nfsd4: more robust ignoring of WANT bits in OPEN nfsd4: move name-length checks to xdr nfsd4: move access/deny validity checks to xdr code ...
This commit is contained in:
@@ -1063,6 +1063,8 @@ static inline int file_check_writeable(struct file *filp)
|
||||
#define FL_LEASE 32 /* lease held on this file */
|
||||
#define FL_CLOSE 64 /* unlock on close */
|
||||
#define FL_SLEEP 128 /* A blocking lock */
|
||||
#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
|
||||
#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
|
||||
|
||||
/*
|
||||
* Special return value from posix_lock_file() and vfs_lock_file() for
|
||||
@@ -1109,7 +1111,7 @@ struct file_lock {
|
||||
struct list_head fl_link; /* doubly linked list of all locks */
|
||||
struct list_head fl_block; /* circular list of blocked processes */
|
||||
fl_owner_t fl_owner;
|
||||
unsigned char fl_flags;
|
||||
unsigned int fl_flags;
|
||||
unsigned char fl_type;
|
||||
unsigned int fl_pid;
|
||||
struct pid *fl_nspid;
|
||||
@@ -1119,7 +1121,9 @@ struct file_lock {
|
||||
loff_t fl_end;
|
||||
|
||||
struct fasync_struct * fl_fasync; /* for lease break notifications */
|
||||
unsigned long fl_break_time; /* for nonblocking lease breaks */
|
||||
/* for lease breaks: */
|
||||
unsigned long fl_break_time;
|
||||
unsigned long fl_downgrade_time;
|
||||
|
||||
const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
|
||||
const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
|
||||
|
@@ -373,6 +373,22 @@ enum nfsstat4 {
|
||||
NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
|
||||
};
|
||||
|
||||
static inline bool seqid_mutating_err(u32 err)
|
||||
{
|
||||
/* rfc 3530 section 8.1.5: */
|
||||
switch (err) {
|
||||
case NFS4ERR_STALE_CLIENTID:
|
||||
case NFS4ERR_STALE_STATEID:
|
||||
case NFS4ERR_BAD_STATEID:
|
||||
case NFS4ERR_BAD_SEQID:
|
||||
case NFS4ERR_BADXDR:
|
||||
case NFS4ERR_RESOURCE:
|
||||
case NFS4ERR_NOFILEHANDLE:
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: NF4BAD is not actually part of the protocol; it is just used
|
||||
* internally by nfsd.
|
||||
@@ -394,7 +410,10 @@ enum open_claim_type4 {
|
||||
NFS4_OPEN_CLAIM_NULL = 0,
|
||||
NFS4_OPEN_CLAIM_PREVIOUS = 1,
|
||||
NFS4_OPEN_CLAIM_DELEGATE_CUR = 2,
|
||||
NFS4_OPEN_CLAIM_DELEGATE_PREV = 3
|
||||
NFS4_OPEN_CLAIM_DELEGATE_PREV = 3,
|
||||
NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */
|
||||
NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */
|
||||
NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */
|
||||
};
|
||||
|
||||
enum opentype4 {
|
||||
|
@@ -1,6 +1,4 @@
|
||||
header-y += const.h
|
||||
header-y += debug.h
|
||||
header-y += export.h
|
||||
header-y += nfsfh.h
|
||||
header-y += stats.h
|
||||
header-y += syscall.h
|
||||
|
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* include/linux/nfsd/const.h
|
||||
*
|
||||
* Various constants related to NFS.
|
||||
*
|
||||
* Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_NFSD_CONST_H
|
||||
#define _LINUX_NFSD_CONST_H
|
||||
|
||||
#include <linux/nfs.h>
|
||||
#include <linux/nfs2.h>
|
||||
#include <linux/nfs3.h>
|
||||
#include <linux/nfs4.h>
|
||||
|
||||
/*
|
||||
* Maximum protocol version supported by knfsd
|
||||
*/
|
||||
#define NFSSVC_MAXVERS 3
|
||||
|
||||
/*
|
||||
* Maximum blocksizes supported by daemon under various circumstances.
|
||||
*/
|
||||
#define NFSSVC_MAXBLKSIZE RPCSVC_MAXPAYLOAD
|
||||
/* NFSv2 is limited by the protocol specification, see RFC 1094 */
|
||||
#define NFSSVC_MAXBLKSIZE_V2 (8*1024)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/sunrpc/msg_prot.h>
|
||||
|
||||
/*
|
||||
* Largest number of bytes we need to allocate for an NFS
|
||||
* call or reply. Used to control buffer sizes. We use
|
||||
* the length of v3 WRITE, READDIR and READDIR replies
|
||||
* which are an RPC header, up to 26 XDR units of reply
|
||||
* data, and some page data.
|
||||
*
|
||||
* Note that accuracy here doesn't matter too much as the
|
||||
* size is rounded up to a page size when allocating space.
|
||||
*/
|
||||
#define NFSD_BUFSIZE ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE)
|
||||
|
||||
#ifdef CONFIG_NFSD_V4
|
||||
# define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE
|
||||
#elif defined(CONFIG_NFSD_V3)
|
||||
# define NFSSVC_XDRSIZE NFS3_SVC_XDRSIZE
|
||||
#else
|
||||
# define NFSSVC_XDRSIZE NFS2_SVC_XDRSIZE
|
||||
#endif
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_NFSD_CONST_H */
|
@@ -96,7 +96,6 @@ struct svc_export {
|
||||
struct auth_domain * ex_client;
|
||||
int ex_flags;
|
||||
struct path ex_path;
|
||||
char *ex_pathname;
|
||||
uid_t ex_anon_uid;
|
||||
gid_t ex_anon_gid;
|
||||
int ex_fsid;
|
||||
@@ -137,6 +136,7 @@ struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
|
||||
struct path *);
|
||||
struct svc_export * rqst_exp_parent(struct svc_rqst *,
|
||||
struct path *);
|
||||
struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
|
||||
int exp_rootfh(struct auth_domain *,
|
||||
char *path, struct knfsd_fh *, int maxsize);
|
||||
__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
|
||||
|
@@ -14,11 +14,14 @@
|
||||
#ifndef _LINUX_NFSD_FH_H
|
||||
#define _LINUX_NFSD_FH_H
|
||||
|
||||
# include <linux/types.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/nfs.h>
|
||||
#include <linux/nfs2.h>
|
||||
#include <linux/nfs3.h>
|
||||
#include <linux/nfs4.h>
|
||||
#ifdef __KERNEL__
|
||||
# include <linux/sunrpc/svc.h>
|
||||
#endif
|
||||
#include <linux/nfsd/const.h>
|
||||
|
||||
/*
|
||||
* This is the old "dentry style" Linux NFSv2 file handle.
|
||||
|
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* include/linux/nfsd/syscall.h
|
||||
*
|
||||
* This file holds all declarations for the knfsd syscall interface.
|
||||
*
|
||||
* Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
|
||||
*/
|
||||
|
||||
#ifndef NFSD_SYSCALL_H
|
||||
#define NFSD_SYSCALL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/nfsd/export.h>
|
||||
|
||||
/*
|
||||
* Version of the syscall interface
|
||||
*/
|
||||
#define NFSCTL_VERSION 0x0201
|
||||
|
||||
/*
|
||||
* These are the commands understood by nfsctl().
|
||||
*/
|
||||
#define NFSCTL_SVC 0 /* This is a server process. */
|
||||
#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
|
||||
#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
|
||||
#define NFSCTL_EXPORT 3 /* export a file system. */
|
||||
#define NFSCTL_UNEXPORT 4 /* unexport a file system. */
|
||||
/*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
|
||||
/*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
|
||||
#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
|
||||
#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
|
||||
|
||||
/* SVC */
|
||||
struct nfsctl_svc {
|
||||
unsigned short svc_port;
|
||||
int svc_nthreads;
|
||||
};
|
||||
|
||||
/* ADDCLIENT/DELCLIENT */
|
||||
struct nfsctl_client {
|
||||
char cl_ident[NFSCLNT_IDMAX+1];
|
||||
int cl_naddr;
|
||||
struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
|
||||
int cl_fhkeytype;
|
||||
int cl_fhkeylen;
|
||||
unsigned char cl_fhkey[NFSCLNT_KEYMAX];
|
||||
};
|
||||
|
||||
/* EXPORT/UNEXPORT */
|
||||
struct nfsctl_export {
|
||||
char ex_client[NFSCLNT_IDMAX+1];
|
||||
char ex_path[NFS_MAXPATHLEN+1];
|
||||
__kernel_old_dev_t ex_dev;
|
||||
__kernel_ino_t ex_ino;
|
||||
int ex_flags;
|
||||
__kernel_uid_t ex_anon_uid;
|
||||
__kernel_gid_t ex_anon_gid;
|
||||
};
|
||||
|
||||
/* GETFD */
|
||||
struct nfsctl_fdparm {
|
||||
struct sockaddr gd_addr;
|
||||
char gd_path[NFS_MAXPATHLEN+1];
|
||||
int gd_version;
|
||||
};
|
||||
|
||||
/* GETFS - GET Filehandle with Size */
|
||||
struct nfsctl_fsparm {
|
||||
struct sockaddr gd_addr;
|
||||
char gd_path[NFS_MAXPATHLEN+1];
|
||||
int gd_maxlen;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the argument union.
|
||||
*/
|
||||
struct nfsctl_arg {
|
||||
int ca_version; /* safeguard */
|
||||
union {
|
||||
struct nfsctl_svc u_svc;
|
||||
struct nfsctl_client u_client;
|
||||
struct nfsctl_export u_export;
|
||||
struct nfsctl_fdparm u_getfd;
|
||||
struct nfsctl_fsparm u_getfs;
|
||||
/*
|
||||
* The following dummy member is needed to preserve binary compatibility
|
||||
* on platforms where alignof(void*)>alignof(int). It's needed because
|
||||
* this union used to contain a member (u_umap) which contained a
|
||||
* pointer.
|
||||
*/
|
||||
void *u_ptr;
|
||||
} u;
|
||||
#define ca_svc u.u_svc
|
||||
#define ca_client u.u_client
|
||||
#define ca_export u.u_export
|
||||
#define ca_getfd u.u_getfd
|
||||
#define ca_getfs u.u_getfs
|
||||
};
|
||||
|
||||
union nfsctl_res {
|
||||
__u8 cr_getfh[NFS_FHSIZE];
|
||||
struct knfsd_fh cr_getfs;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* Kernel syscall implementation.
|
||||
*/
|
||||
extern int exp_addclient(struct nfsctl_client *ncp);
|
||||
extern int exp_delclient(struct nfsctl_client *ncp);
|
||||
extern int exp_export(struct nfsctl_export *nxp);
|
||||
extern int exp_unexport(struct nfsctl_export *nxp);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* NFSD_SYSCALL_H */
|
@@ -218,7 +218,13 @@ static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
|
||||
{
|
||||
const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
|
||||
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
|
||||
return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
|
||||
|
||||
if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
|
||||
return false;
|
||||
else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||
return sin1->sin6_scope_id == sin2->sin6_scope_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool __rpc_copy_addr6(struct sockaddr *dst,
|
||||
|
@@ -212,11 +212,6 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
|
||||
iov->iov_len += sizeof(__be32);
|
||||
}
|
||||
|
||||
union svc_addr_u {
|
||||
struct in_addr addr;
|
||||
struct in6_addr addr6;
|
||||
};
|
||||
|
||||
/*
|
||||
* The context of a single thread, including the request currently being
|
||||
* processed.
|
||||
@@ -225,8 +220,12 @@ struct svc_rqst {
|
||||
struct list_head rq_list; /* idle list */
|
||||
struct list_head rq_all; /* all threads list */
|
||||
struct svc_xprt * rq_xprt; /* transport ptr */
|
||||
|
||||
struct sockaddr_storage rq_addr; /* peer address */
|
||||
size_t rq_addrlen;
|
||||
struct sockaddr_storage rq_daddr; /* dest addr of request
|
||||
* - reply from here */
|
||||
size_t rq_daddrlen;
|
||||
|
||||
struct svc_serv * rq_server; /* RPC service definition */
|
||||
struct svc_pool * rq_pool; /* thread pool */
|
||||
@@ -255,9 +254,6 @@ struct svc_rqst {
|
||||
unsigned short
|
||||
rq_secure : 1; /* secure port */
|
||||
|
||||
union svc_addr_u rq_daddr; /* dest addr of request
|
||||
* - reply from here */
|
||||
|
||||
void * rq_argp; /* decoded arguments */
|
||||
void * rq_resp; /* xdr'd results */
|
||||
void * rq_auth_data; /* flavor-specific data */
|
||||
@@ -300,6 +296,21 @@ static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst)
|
||||
return (struct sockaddr *) &rqst->rq_addr;
|
||||
}
|
||||
|
||||
static inline struct sockaddr_in *svc_daddr_in(const struct svc_rqst *rqst)
|
||||
{
|
||||
return (struct sockaddr_in *) &rqst->rq_daddr;
|
||||
}
|
||||
|
||||
static inline struct sockaddr_in6 *svc_daddr_in6(const struct svc_rqst *rqst)
|
||||
{
|
||||
return (struct sockaddr_in6 *) &rqst->rq_daddr;
|
||||
}
|
||||
|
||||
static inline struct sockaddr *svc_daddr(const struct svc_rqst *rqst)
|
||||
{
|
||||
return (struct sockaddr *) &rqst->rq_daddr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check buffer bounds after decoding arguments
|
||||
*/
|
||||
@@ -340,7 +351,8 @@ struct svc_deferred_req {
|
||||
struct svc_xprt *xprt;
|
||||
struct sockaddr_storage addr; /* where reply must go */
|
||||
size_t addrlen;
|
||||
union svc_addr_u daddr; /* where reply must come from */
|
||||
struct sockaddr_storage daddr; /* where reply must come from */
|
||||
size_t daddrlen;
|
||||
struct cache_deferred_req handle;
|
||||
size_t xprt_hlen;
|
||||
int argslen;
|
||||
@@ -404,7 +416,7 @@ struct svc_procedure {
|
||||
struct svc_serv *svc_create(struct svc_program *, unsigned int,
|
||||
void (*shutdown)(struct svc_serv *));
|
||||
struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
|
||||
struct svc_pool *pool);
|
||||
struct svc_pool *pool, int node);
|
||||
void svc_exit_thread(struct svc_rqst *);
|
||||
struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
|
||||
void (*shutdown)(struct svc_serv *),
|
||||
|
Reference in New Issue
Block a user