aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1b2f67f5eef6..8a5f777b1e96 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -54,18 +54,21 @@
54/* Globals */ 54/* Globals */
55static time_t lease_time = 90; /* default lease time */ 55static time_t lease_time = 90; /* default lease time */
56static time_t user_lease_time = 90; 56static time_t user_lease_time = 90;
57time_t boot_time; 57static time_t boot_time;
58static int in_grace = 1; 58static int in_grace = 1;
59static u32 current_clientid = 1; 59static u32 current_clientid = 1;
60static u32 current_ownerid = 1; 60static u32 current_ownerid = 1;
61static u32 current_fileid = 1; 61static u32 current_fileid = 1;
62static u32 current_delegid = 1; 62static u32 current_delegid = 1;
63static u32 nfs4_init; 63static u32 nfs4_init;
64stateid_t zerostateid; /* bits all 0 */ 64static stateid_t zerostateid; /* bits all 0 */
65stateid_t onestateid; /* bits all 1 */ 65static stateid_t onestateid; /* bits all 1 */
66
67#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
68#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
66 69
67/* forward declarations */ 70/* forward declarations */
68struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); 71static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
69static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); 72static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
70static void release_stateid_lockowners(struct nfs4_stateid *open_stp); 73static void release_stateid_lockowners(struct nfs4_stateid *open_stp);
71 74
@@ -77,10 +80,10 @@ static void release_stateid_lockowners(struct nfs4_stateid *open_stp);
77 */ 80 */
78static DECLARE_MUTEX(client_sema); 81static DECLARE_MUTEX(client_sema);
79 82
80kmem_cache_t *stateowner_slab = NULL; 83static kmem_cache_t *stateowner_slab = NULL;
81kmem_cache_t *file_slab = NULL; 84static kmem_cache_t *file_slab = NULL;
82kmem_cache_t *stateid_slab = NULL; 85static kmem_cache_t *stateid_slab = NULL;
83kmem_cache_t *deleg_slab = NULL; 86static kmem_cache_t *deleg_slab = NULL;
84 87
85void 88void
86nfs4_lock_state(void) 89nfs4_lock_state(void)
@@ -116,7 +119,7 @@ static void release_stateid(struct nfs4_stateid *stp, int flags);
116 */ 119 */
117 120
118/* recall_lock protects the del_recall_lru */ 121/* recall_lock protects the del_recall_lru */
119spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; 122static spinlock_t recall_lock = SPIN_LOCK_UNLOCKED;
120static struct list_head del_recall_lru; 123static struct list_head del_recall_lru;
121 124
122static void 125static void
@@ -456,7 +459,7 @@ check_name(struct xdr_netobj name) {
456 return 1; 459 return 1;
457} 460}
458 461
459void 462static void
460add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval) 463add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval)
461{ 464{
462 unsigned int idhashval; 465 unsigned int idhashval;
@@ -468,7 +471,7 @@ add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval)
468 clp->cl_time = get_seconds(); 471 clp->cl_time = get_seconds();
469} 472}
470 473
471void 474static void
472move_to_confirmed(struct nfs4_client *clp) 475move_to_confirmed(struct nfs4_client *clp)
473{ 476{
474 unsigned int idhashval = clientid_hashval(clp->cl_clientid.cl_id); 477 unsigned int idhashval = clientid_hashval(clp->cl_clientid.cl_id);
@@ -567,7 +570,7 @@ parse_octet(unsigned int *lenp, char **addrp)
567} 570}
568 571
569/* parse and set the setclientid ipv4 callback address */ 572/* parse and set the setclientid ipv4 callback address */
570int 573static int
571parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigned short *cbportp) 574parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigned short *cbportp)
572{ 575{
573 int temp = 0; 576 int temp = 0;
@@ -603,7 +606,7 @@ parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigne
603 return 1; 606 return 1;
604} 607}
605 608
606void 609static void
607gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se) 610gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se)
608{ 611{
609 struct nfs4_callback *cb = &clp->cl_callback; 612 struct nfs4_callback *cb = &clp->cl_callback;
@@ -1186,7 +1189,7 @@ release_stateid(struct nfs4_stateid *stp, int flags)
1186 stp = NULL; 1189 stp = NULL;
1187} 1190}
1188 1191
1189void 1192static void
1190move_to_close_lru(struct nfs4_stateowner *sop) 1193move_to_close_lru(struct nfs4_stateowner *sop)
1191{ 1194{
1192 dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop); 1195 dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop);
@@ -1196,7 +1199,7 @@ move_to_close_lru(struct nfs4_stateowner *sop)
1196 sop->so_time = get_seconds(); 1199 sop->so_time = get_seconds();
1197} 1200}
1198 1201
1199void 1202static void
1200release_state_owner(struct nfs4_stateid *stp, int flag) 1203release_state_owner(struct nfs4_stateid *stp, int flag)
1201{ 1204{
1202 struct nfs4_stateowner *sop = stp->st_stateowner; 1205 struct nfs4_stateowner *sop = stp->st_stateowner;
@@ -1250,7 +1253,7 @@ find_file(struct inode *ino)
1250#define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0) 1253#define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0)
1251#define TEST_DENY(x) ((x >= 0 || x < 5)?1:0) 1254#define TEST_DENY(x) ((x >= 0 || x < 5)?1:0)
1252 1255
1253void 1256static void
1254set_access(unsigned int *access, unsigned long bmap) { 1257set_access(unsigned int *access, unsigned long bmap) {
1255 int i; 1258 int i;
1256 1259
@@ -1261,7 +1264,7 @@ set_access(unsigned int *access, unsigned long bmap) {
1261 } 1264 }
1262} 1265}
1263 1266
1264void 1267static void
1265set_deny(unsigned int *deny, unsigned long bmap) { 1268set_deny(unsigned int *deny, unsigned long bmap) {
1266 int i; 1269 int i;
1267 1270
@@ -1287,7 +1290,7 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) {
1287 * Called to check deny when READ with all zero stateid or 1290 * Called to check deny when READ with all zero stateid or
1288 * WRITE with all zero or all one stateid 1291 * WRITE with all zero or all one stateid
1289 */ 1292 */
1290int 1293static int
1291nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) 1294nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
1292{ 1295{
1293 struct inode *ino = current_fh->fh_dentry->d_inode; 1296 struct inode *ino = current_fh->fh_dentry->d_inode;
@@ -1442,7 +1445,7 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg)
1442 return -EAGAIN; 1445 return -EAGAIN;
1443} 1446}
1444 1447
1445struct lock_manager_operations nfsd_lease_mng_ops = { 1448static struct lock_manager_operations nfsd_lease_mng_ops = {
1446 .fl_break = nfsd_break_deleg_cb, 1449 .fl_break = nfsd_break_deleg_cb,
1447 .fl_release_private = nfsd_release_deleg_cb, 1450 .fl_release_private = nfsd_release_deleg_cb,
1448 .fl_copy_lock = nfsd_copy_lock_deleg_cb, 1451 .fl_copy_lock = nfsd_copy_lock_deleg_cb,
@@ -1915,7 +1918,7 @@ end_grace(void)
1915 in_grace = 0; 1918 in_grace = 0;
1916} 1919}
1917 1920
1918time_t 1921static time_t
1919nfs4_laundromat(void) 1922nfs4_laundromat(void)
1920{ 1923{
1921 struct nfs4_client *clp; 1924 struct nfs4_client *clp;
@@ -1996,7 +1999,7 @@ laundromat_main(void *not_used)
1996/* search ownerid_hashtbl[] and close_lru for stateid owner 1999/* search ownerid_hashtbl[] and close_lru for stateid owner
1997 * (stateid->si_stateownerid) 2000 * (stateid->si_stateownerid)
1998 */ 2001 */
1999struct nfs4_stateowner * 2002static struct nfs4_stateowner *
2000find_openstateowner_id(u32 st_id, int flags) { 2003find_openstateowner_id(u32 st_id, int flags) {
2001 struct nfs4_stateowner *local = NULL; 2004 struct nfs4_stateowner *local = NULL;
2002 2005
@@ -2170,7 +2173,7 @@ out:
2170/* 2173/*
2171 * Checks for sequence id mutating operations. 2174 * Checks for sequence id mutating operations.
2172 */ 2175 */
2173int 2176static int
2174nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid) 2177nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid)
2175{ 2178{
2176 int status; 2179 int status;
@@ -2486,7 +2489,7 @@ static struct list_head lock_ownerid_hashtbl[LOCK_HASH_SIZE];
2486static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE]; 2489static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE];
2487static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE]; 2490static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE];
2488 2491
2489struct nfs4_stateid * 2492static struct nfs4_stateid *
2490find_stateid(stateid_t *stid, int flags) 2493find_stateid(stateid_t *stid, int flags)
2491{ 2494{
2492 struct nfs4_stateid *local = NULL; 2495 struct nfs4_stateid *local = NULL;
@@ -2550,7 +2553,7 @@ nfs4_transform_lock_offset(struct file_lock *lock)
2550 lock->fl_end = OFFSET_MAX; 2553 lock->fl_end = OFFSET_MAX;
2551} 2554}
2552 2555
2553int 2556static int
2554nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval) 2557nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval)
2555{ 2558{
2556 struct nfs4_stateowner *local = NULL; 2559 struct nfs4_stateowner *local = NULL;
@@ -2660,7 +2663,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
2660 return sop; 2663 return sop;
2661} 2664}
2662 2665
2663struct nfs4_stateid * 2666static struct nfs4_stateid *
2664alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp) 2667alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp)
2665{ 2668{
2666 struct nfs4_stateid *stp; 2669 struct nfs4_stateid *stp;
@@ -2691,7 +2694,7 @@ out:
2691 return stp; 2694 return stp;
2692} 2695}
2693 2696
2694int 2697static int
2695check_lock_length(u64 offset, u64 length) 2698check_lock_length(u64 offset, u64 length)
2696{ 2699{
2697 return ((length == 0) || ((length != ~(u64)0) && 2700 return ((length == 0) || ((length != ~(u64)0) &&
@@ -3149,7 +3152,7 @@ nfs4_release_reclaim(void)
3149 3152
3150/* 3153/*
3151 * called from OPEN, CLAIM_PREVIOUS with a new clientid. */ 3154 * called from OPEN, CLAIM_PREVIOUS with a new clientid. */
3152struct nfs4_client_reclaim * 3155static struct nfs4_client_reclaim *
3153nfs4_find_reclaim_client(clientid_t *clid) 3156nfs4_find_reclaim_client(clientid_t *clid)
3154{ 3157{
3155 unsigned int strhashval; 3158 unsigned int strhashval;