diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e83b3c865aa3..6ab30772496e 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -75,7 +75,6 @@ static stateid_t onestateid; /* bits all 1 */ | |||
75 | /* forward declarations */ | 75 | /* forward declarations */ |
76 | static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); | 76 | static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); |
77 | static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); | 77 | static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); |
78 | static void release_stateid_lockowners(struct nfs4_stateid *open_stp); | ||
79 | static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery"; | 78 | static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery"; |
80 | static void nfs4_set_recdir(char *recdir); | 79 | static void nfs4_set_recdir(char *recdir); |
81 | 80 | ||
@@ -330,6 +329,20 @@ static void release_lock_stateid(struct nfs4_stateid *stp) | |||
330 | free_generic_stateid(stp); | 329 | free_generic_stateid(stp); |
331 | } | 330 | } |
332 | 331 | ||
332 | static void | ||
333 | release_stateid_lockowners(struct nfs4_stateid *open_stp) | ||
334 | { | ||
335 | struct nfs4_stateowner *lock_sop; | ||
336 | |||
337 | while (!list_empty(&open_stp->st_lockowners)) { | ||
338 | lock_sop = list_entry(open_stp->st_lockowners.next, | ||
339 | struct nfs4_stateowner, so_perstateid); | ||
340 | /* list_del(&open_stp->st_lockowners); */ | ||
341 | BUG_ON(lock_sop->so_is_open_owner); | ||
342 | release_stateowner(lock_sop); | ||
343 | } | ||
344 | } | ||
345 | |||
333 | static void release_open_stateid(struct nfs4_stateid *stp) | 346 | static void release_open_stateid(struct nfs4_stateid *stp) |
334 | { | 347 | { |
335 | unhash_generic_stateid(stp); | 348 | unhash_generic_stateid(stp); |
@@ -338,6 +351,34 @@ static void release_open_stateid(struct nfs4_stateid *stp) | |||
338 | free_generic_stateid(stp); | 351 | free_generic_stateid(stp); |
339 | } | 352 | } |
340 | 353 | ||
354 | static void | ||
355 | unhash_stateowner(struct nfs4_stateowner *sop) | ||
356 | { | ||
357 | struct nfs4_stateid *stp; | ||
358 | |||
359 | list_del(&sop->so_idhash); | ||
360 | list_del(&sop->so_strhash); | ||
361 | if (sop->so_is_open_owner) | ||
362 | list_del(&sop->so_perclient); | ||
363 | list_del(&sop->so_perstateid); | ||
364 | while (!list_empty(&sop->so_stateids)) { | ||
365 | stp = list_entry(sop->so_stateids.next, | ||
366 | struct nfs4_stateid, st_perstateowner); | ||
367 | if (sop->so_is_open_owner) | ||
368 | release_open_stateid(stp); | ||
369 | else | ||
370 | release_lock_stateid(stp); | ||
371 | } | ||
372 | } | ||
373 | |||
374 | static void | ||
375 | release_stateowner(struct nfs4_stateowner *sop) | ||
376 | { | ||
377 | unhash_stateowner(sop); | ||
378 | list_del(&sop->so_close_lru); | ||
379 | nfs4_put_stateowner(sop); | ||
380 | } | ||
381 | |||
341 | static inline void | 382 | static inline void |
342 | renew_client(struct nfs4_client *clp) | 383 | renew_client(struct nfs4_client *clp) |
343 | { | 384 | { |
@@ -1064,48 +1105,6 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, str | |||
1064 | return sop; | 1105 | return sop; |
1065 | } | 1106 | } |
1066 | 1107 | ||
1067 | static void | ||
1068 | release_stateid_lockowners(struct nfs4_stateid *open_stp) | ||
1069 | { | ||
1070 | struct nfs4_stateowner *lock_sop; | ||
1071 | |||
1072 | while (!list_empty(&open_stp->st_lockowners)) { | ||
1073 | lock_sop = list_entry(open_stp->st_lockowners.next, | ||
1074 | struct nfs4_stateowner, so_perstateid); | ||
1075 | /* list_del(&open_stp->st_lockowners); */ | ||
1076 | BUG_ON(lock_sop->so_is_open_owner); | ||
1077 | release_stateowner(lock_sop); | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | static void | ||
1082 | unhash_stateowner(struct nfs4_stateowner *sop) | ||
1083 | { | ||
1084 | struct nfs4_stateid *stp; | ||
1085 | |||
1086 | list_del(&sop->so_idhash); | ||
1087 | list_del(&sop->so_strhash); | ||
1088 | if (sop->so_is_open_owner) | ||
1089 | list_del(&sop->so_perclient); | ||
1090 | list_del(&sop->so_perstateid); | ||
1091 | while (!list_empty(&sop->so_stateids)) { | ||
1092 | stp = list_entry(sop->so_stateids.next, | ||
1093 | struct nfs4_stateid, st_perstateowner); | ||
1094 | if (sop->so_is_open_owner) | ||
1095 | release_open_stateid(stp); | ||
1096 | else | ||
1097 | release_lock_stateid(stp); | ||
1098 | } | ||
1099 | } | ||
1100 | |||
1101 | static void | ||
1102 | release_stateowner(struct nfs4_stateowner *sop) | ||
1103 | { | ||
1104 | unhash_stateowner(sop); | ||
1105 | list_del(&sop->so_close_lru); | ||
1106 | nfs4_put_stateowner(sop); | ||
1107 | } | ||
1108 | |||
1109 | static inline void | 1108 | static inline void |
1110 | init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) { | 1109 | init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) { |
1111 | struct nfs4_stateowner *sop = open->op_stateowner; | 1110 | struct nfs4_stateowner *sop = open->op_stateowner; |