diff options
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 57 |
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 */ |
55 | static time_t lease_time = 90; /* default lease time */ | 55 | static time_t lease_time = 90; /* default lease time */ |
56 | static time_t user_lease_time = 90; | 56 | static time_t user_lease_time = 90; |
57 | time_t boot_time; | 57 | static time_t boot_time; |
58 | static int in_grace = 1; | 58 | static int in_grace = 1; |
59 | static u32 current_clientid = 1; | 59 | static u32 current_clientid = 1; |
60 | static u32 current_ownerid = 1; | 60 | static u32 current_ownerid = 1; |
61 | static u32 current_fileid = 1; | 61 | static u32 current_fileid = 1; |
62 | static u32 current_delegid = 1; | 62 | static u32 current_delegid = 1; |
63 | static u32 nfs4_init; | 63 | static u32 nfs4_init; |
64 | stateid_t zerostateid; /* bits all 0 */ | 64 | static stateid_t zerostateid; /* bits all 0 */ |
65 | stateid_t onestateid; /* bits all 1 */ | 65 | static 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 */ |
68 | struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); | 71 | static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); |
69 | static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); | 72 | static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); |
70 | static void release_stateid_lockowners(struct nfs4_stateid *open_stp); | 73 | static 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 | */ |
78 | static DECLARE_MUTEX(client_sema); | 81 | static DECLARE_MUTEX(client_sema); |
79 | 82 | ||
80 | kmem_cache_t *stateowner_slab = NULL; | 83 | static kmem_cache_t *stateowner_slab = NULL; |
81 | kmem_cache_t *file_slab = NULL; | 84 | static kmem_cache_t *file_slab = NULL; |
82 | kmem_cache_t *stateid_slab = NULL; | 85 | static kmem_cache_t *stateid_slab = NULL; |
83 | kmem_cache_t *deleg_slab = NULL; | 86 | static kmem_cache_t *deleg_slab = NULL; |
84 | 87 | ||
85 | void | 88 | void |
86 | nfs4_lock_state(void) | 89 | nfs4_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 */ |
119 | spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; | 122 | static spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; |
120 | static struct list_head del_recall_lru; | 123 | static struct list_head del_recall_lru; |
121 | 124 | ||
122 | static void | 125 | static void |
@@ -456,7 +459,7 @@ check_name(struct xdr_netobj name) { | |||
456 | return 1; | 459 | return 1; |
457 | } | 460 | } |
458 | 461 | ||
459 | void | 462 | static void |
460 | add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval) | 463 | add_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 | ||
471 | void | 474 | static void |
472 | move_to_confirmed(struct nfs4_client *clp) | 475 | move_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 */ |
570 | int | 573 | static int |
571 | parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigned short *cbportp) | 574 | parse_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 | ||
606 | void | 609 | static void |
607 | gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se) | 610 | gen_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 | ||
1189 | void | 1192 | static void |
1190 | move_to_close_lru(struct nfs4_stateowner *sop) | 1193 | move_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 | ||
1199 | void | 1202 | static void |
1200 | release_state_owner(struct nfs4_stateid *stp, int flag) | 1203 | release_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 | ||
1253 | void | 1256 | static void |
1254 | set_access(unsigned int *access, unsigned long bmap) { | 1257 | set_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 | ||
1264 | void | 1267 | static void |
1265 | set_deny(unsigned int *deny, unsigned long bmap) { | 1268 | set_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 | */ |
1290 | int | 1293 | static int |
1291 | nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) | 1294 | nfs4_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 | ||
1445 | struct lock_manager_operations nfsd_lease_mng_ops = { | 1448 | static 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 | ||
1918 | time_t | 1921 | static time_t |
1919 | nfs4_laundromat(void) | 1922 | nfs4_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 | */ |
1999 | struct nfs4_stateowner * | 2002 | static struct nfs4_stateowner * |
2000 | find_openstateowner_id(u32 st_id, int flags) { | 2003 | find_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 | */ |
2173 | int | 2176 | static int |
2174 | nfs4_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) | 2177 | nfs4_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]; | |||
2486 | static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE]; | 2489 | static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE]; |
2487 | static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE]; | 2490 | static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE]; |
2488 | 2491 | ||
2489 | struct nfs4_stateid * | 2492 | static struct nfs4_stateid * |
2490 | find_stateid(stateid_t *stid, int flags) | 2493 | find_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 | ||
2553 | int | 2556 | static int |
2554 | nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval) | 2557 | nfs4_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 | ||
2663 | struct nfs4_stateid * | 2666 | static struct nfs4_stateid * |
2664 | alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp) | 2667 | alloc_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 | ||
2694 | int | 2697 | static int |
2695 | check_lock_length(u64 offset, u64 length) | 2698 | check_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. */ |
3152 | struct nfs4_client_reclaim * | 3155 | static struct nfs4_client_reclaim * |
3153 | nfs4_find_reclaim_client(clientid_t *clid) | 3156 | nfs4_find_reclaim_client(clientid_t *clid) |
3154 | { | 3157 | { |
3155 | unsigned int strhashval; | 3158 | unsigned int strhashval; |