Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63825
b: refs/heads/master
c: 5e11934
h: refs/heads/master
i:
  63823: 2893a6e
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Aug 7, 2007
1 parent 75c6940 commit cad5bad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b247bbf1da69ce376aa1ceb8057331214589e366
refs/heads/master: 5e11934d13c9a3bcb0cadad6c7a7de5c32660422
24 changes: 8 additions & 16 deletions trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,29 +468,26 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
ctx->lockowner = current->files;
ctx->error = 0;
ctx->dir_cookie = 0;
kref_init(&ctx->kref);
atomic_set(&ctx->count, 1);
}
return ctx;
}

struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
{
if (ctx != NULL)
kref_get(&ctx->kref);
atomic_inc(&ctx->count);
return ctx;
}

static void nfs_free_open_context(struct kref *kref)
void put_nfs_open_context(struct nfs_open_context *ctx)
{
struct nfs_open_context *ctx = container_of(kref,
struct nfs_open_context, kref);
struct inode *inode = ctx->path.dentry->d_inode;

if (!list_empty(&ctx->list)) {
struct inode *inode = ctx->path.dentry->d_inode;
spin_lock(&inode->i_lock);
list_del(&ctx->list);
spin_unlock(&inode->i_lock);
}
if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock))
return;
list_del(&ctx->list);
spin_unlock(&inode->i_lock);
if (ctx->state != NULL)
nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
if (ctx->cred != NULL)
Expand All @@ -500,11 +497,6 @@ static void nfs_free_open_context(struct kref *kref)
kfree(ctx);
}

void put_nfs_open_context(struct nfs_open_context *ctx)
{
kref_put(&ctx->kref, nfs_free_open_context);
}

/*
* Ensure that mmap has a recent RPC credential for use when writing out
* shared pages
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct nfs_access_entry {

struct nfs4_state;
struct nfs_open_context {
struct kref kref;
atomic_t count;
struct path path;
struct rpc_cred *cred;
struct nfs4_state *state;
Expand Down

0 comments on commit cad5bad

Please sign in to comment.