diff options
-rw-r--r-- | fs/nfs/inode.c | 12 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 134d9f560240..52a60e399a2d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -783,7 +783,7 @@ EXPORT_SYMBOL_GPL(nfs_getattr); | |||
783 | 783 | ||
784 | static void nfs_init_lock_context(struct nfs_lock_context *l_ctx) | 784 | static void nfs_init_lock_context(struct nfs_lock_context *l_ctx) |
785 | { | 785 | { |
786 | atomic_set(&l_ctx->count, 1); | 786 | refcount_set(&l_ctx->count, 1); |
787 | l_ctx->lockowner = current->files; | 787 | l_ctx->lockowner = current->files; |
788 | INIT_LIST_HEAD(&l_ctx->list); | 788 | INIT_LIST_HEAD(&l_ctx->list); |
789 | atomic_set(&l_ctx->io_count, 0); | 789 | atomic_set(&l_ctx->io_count, 0); |
@@ -797,7 +797,7 @@ static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context | |||
797 | do { | 797 | do { |
798 | if (pos->lockowner != current->files) | 798 | if (pos->lockowner != current->files) |
799 | continue; | 799 | continue; |
800 | atomic_inc(&pos->count); | 800 | refcount_inc(&pos->count); |
801 | return pos; | 801 | return pos; |
802 | } while ((pos = list_entry(pos->list.next, typeof(*pos), list)) != head); | 802 | } while ((pos = list_entry(pos->list.next, typeof(*pos), list)) != head); |
803 | return NULL; | 803 | return NULL; |
@@ -836,7 +836,7 @@ void nfs_put_lock_context(struct nfs_lock_context *l_ctx) | |||
836 | struct nfs_open_context *ctx = l_ctx->open_context; | 836 | struct nfs_open_context *ctx = l_ctx->open_context; |
837 | struct inode *inode = d_inode(ctx->dentry); | 837 | struct inode *inode = d_inode(ctx->dentry); |
838 | 838 | ||
839 | if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock)) | 839 | if (!refcount_dec_and_lock(&l_ctx->count, &inode->i_lock)) |
840 | return; | 840 | return; |
841 | list_del(&l_ctx->list); | 841 | list_del(&l_ctx->list); |
842 | spin_unlock(&inode->i_lock); | 842 | spin_unlock(&inode->i_lock); |
@@ -913,7 +913,7 @@ EXPORT_SYMBOL_GPL(alloc_nfs_open_context); | |||
913 | struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) | 913 | struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) |
914 | { | 914 | { |
915 | if (ctx != NULL) | 915 | if (ctx != NULL) |
916 | atomic_inc(&ctx->lock_context.count); | 916 | refcount_inc(&ctx->lock_context.count); |
917 | return ctx; | 917 | return ctx; |
918 | } | 918 | } |
919 | EXPORT_SYMBOL_GPL(get_nfs_open_context); | 919 | EXPORT_SYMBOL_GPL(get_nfs_open_context); |
@@ -924,11 +924,11 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) | |||
924 | struct super_block *sb = ctx->dentry->d_sb; | 924 | struct super_block *sb = ctx->dentry->d_sb; |
925 | 925 | ||
926 | if (!list_empty(&ctx->list)) { | 926 | if (!list_empty(&ctx->list)) { |
927 | if (!atomic_dec_and_lock(&ctx->lock_context.count, &inode->i_lock)) | 927 | if (!refcount_dec_and_lock(&ctx->lock_context.count, &inode->i_lock)) |
928 | return; | 928 | return; |
929 | list_del(&ctx->list); | 929 | list_del(&ctx->list); |
930 | spin_unlock(&inode->i_lock); | 930 | spin_unlock(&inode->i_lock); |
931 | } else if (!atomic_dec_and_test(&ctx->lock_context.count)) | 931 | } else if (!refcount_dec_and_test(&ctx->lock_context.count)) |
932 | return; | 932 | return; |
933 | if (inode != NULL) | 933 | if (inode != NULL) |
934 | NFS_PROTO(inode)->close_context(ctx, is_sync); | 934 | NFS_PROTO(inode)->close_context(ctx, is_sync); |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 453f491a5fda..e6706913e6c2 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/rbtree.h> | 24 | #include <linux/rbtree.h> |
25 | #include <linux/refcount.h> | ||
25 | #include <linux/rwsem.h> | 26 | #include <linux/rwsem.h> |
26 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
27 | 28 | ||
@@ -55,7 +56,7 @@ struct nfs_access_entry { | |||
55 | }; | 56 | }; |
56 | 57 | ||
57 | struct nfs_lock_context { | 58 | struct nfs_lock_context { |
58 | atomic_t count; | 59 | refcount_t count; |
59 | struct list_head list; | 60 | struct list_head list; |
60 | struct nfs_open_context *open_context; | 61 | struct nfs_open_context *open_context; |
61 | fl_owner_t lockowner; | 62 | fl_owner_t lockowner; |