aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c3
-rw-r--r--fs/nfs/nfs4state.c24
3 files changed, 14 insertions, 15 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 4d7d0aedc101..654b091644c5 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -319,7 +319,7 @@ static inline void nfs4_schedule_session_recovery(struct nfs4_session *session)
319} 319}
320#endif /* CONFIG_NFS_V4_1 */ 320#endif /* CONFIG_NFS_V4_1 */
321 321
322extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); 322extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *, gfp_t);
323extern void nfs4_put_state_owner(struct nfs4_state_owner *); 323extern void nfs4_put_state_owner(struct nfs4_state_owner *);
324extern void nfs4_purge_state_owners(struct nfs_server *); 324extern void nfs4_purge_state_owners(struct nfs_server *);
325extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 325extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f0c849c98fe4..53ef365f4372 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1754,7 +1754,8 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, fmode_t fmode
1754 1754
1755 /* Protect against reboot recovery conflicts */ 1755 /* Protect against reboot recovery conflicts */
1756 status = -ENOMEM; 1756 status = -ENOMEM;
1757 if (!(sp = nfs4_get_state_owner(server, cred))) { 1757 sp = nfs4_get_state_owner(server, cred, GFP_KERNEL);
1758 if (sp == NULL) {
1758 dprintk("nfs4_do_open: nfs4_get_state_owner failed!\n"); 1759 dprintk("nfs4_do_open: nfs4_get_state_owner failed!\n");
1759 goto out_err; 1760 goto out_err;
1760 } 1761 }
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index a53f33b4ac3a..a8a42a677d8f 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -444,13 +444,17 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp)
444 * 444 *
445 */ 445 */
446static struct nfs4_state_owner * 446static struct nfs4_state_owner *
447nfs4_alloc_state_owner(void) 447nfs4_alloc_state_owner(struct nfs_server *server,
448 struct rpc_cred *cred,
449 gfp_t gfp_flags)
448{ 450{
449 struct nfs4_state_owner *sp; 451 struct nfs4_state_owner *sp;
450 452
451 sp = kzalloc(sizeof(*sp),GFP_NOFS); 453 sp = kzalloc(sizeof(*sp), gfp_flags);
452 if (!sp) 454 if (!sp)
453 return NULL; 455 return NULL;
456 sp->so_server = server;
457 sp->so_cred = get_rpccred(cred);
454 spin_lock_init(&sp->so_lock); 458 spin_lock_init(&sp->so_lock);
455 INIT_LIST_HEAD(&sp->so_states); 459 INIT_LIST_HEAD(&sp->so_states);
456 rpc_init_wait_queue(&sp->so_sequence.wait, "Seqid_waitqueue"); 460 rpc_init_wait_queue(&sp->so_sequence.wait, "Seqid_waitqueue");
@@ -516,7 +520,8 @@ static void nfs4_gc_state_owners(struct nfs_server *server)
516 * Returns a pointer to an instantiated nfs4_state_owner struct, or NULL. 520 * Returns a pointer to an instantiated nfs4_state_owner struct, or NULL.
517 */ 521 */
518struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, 522struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
519 struct rpc_cred *cred) 523 struct rpc_cred *cred,
524 gfp_t gfp_flags)
520{ 525{
521 struct nfs_client *clp = server->nfs_client; 526 struct nfs_client *clp = server->nfs_client;
522 struct nfs4_state_owner *sp, *new; 527 struct nfs4_state_owner *sp, *new;
@@ -526,20 +531,13 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
526 spin_unlock(&clp->cl_lock); 531 spin_unlock(&clp->cl_lock);
527 if (sp != NULL) 532 if (sp != NULL)
528 goto out; 533 goto out;
529 new = nfs4_alloc_state_owner(); 534 new = nfs4_alloc_state_owner(server, cred, gfp_flags);
530 if (new == NULL) 535 if (new == NULL)
531 goto out; 536 goto out;
532 new->so_server = server;
533 new->so_cred = cred;
534 spin_lock(&clp->cl_lock);
535 sp = nfs4_insert_state_owner_locked(new); 537 sp = nfs4_insert_state_owner_locked(new);
536 spin_unlock(&clp->cl_lock); 538 spin_unlock(&clp->cl_lock);
537 if (sp == new) 539 if (sp != new)
538 get_rpccred(cred); 540 nfs4_free_state_owner(new);
539 else {
540 rpc_destroy_wait_queue(&new->so_sequence.wait);
541 kfree(new);
542 }
543out: 541out:
544 nfs4_gc_state_owners(server); 542 nfs4_gc_state_owners(server);
545 return sp; 543 return sp;