filecache.c (867a448d587e7fa845bceaf4ee1c632448f2a9fa) | filecache.c (b8962a9d8cc2d8c93362e2f684091c79f702f6f3) |
---|---|
1/* 2 * Open file cache. 3 * 4 * (c) 2015 - Jeff Layton <jeff.layton@primarydata.com> 5 */ 6 7#include <linux/hash.h> 8#include <linux/slab.h> --- 105 unchanged lines hidden (view full) --- 114nfsd_file_mark_find_or_create(struct nfsd_file *nf) 115{ 116 int err; 117 struct fsnotify_mark *mark; 118 struct nfsd_file_mark *nfm = NULL, *new; 119 struct inode *inode = nf->nf_inode; 120 121 do { | 1/* 2 * Open file cache. 3 * 4 * (c) 2015 - Jeff Layton <jeff.layton@primarydata.com> 5 */ 6 7#include <linux/hash.h> 8#include <linux/slab.h> --- 105 unchanged lines hidden (view full) --- 114nfsd_file_mark_find_or_create(struct nfsd_file *nf) 115{ 116 int err; 117 struct fsnotify_mark *mark; 118 struct nfsd_file_mark *nfm = NULL, *new; 119 struct inode *inode = nf->nf_inode; 120 121 do { |
122 mutex_lock(&nfsd_file_fsnotify_group->mark_mutex); | 122 fsnotify_group_lock(nfsd_file_fsnotify_group); |
123 mark = fsnotify_find_mark(&inode->i_fsnotify_marks, | 123 mark = fsnotify_find_mark(&inode->i_fsnotify_marks, |
124 nfsd_file_fsnotify_group); | 124 nfsd_file_fsnotify_group); |
125 if (mark) { 126 nfm = nfsd_file_mark_get(container_of(mark, 127 struct nfsd_file_mark, 128 nfm_mark)); | 125 if (mark) { 126 nfm = nfsd_file_mark_get(container_of(mark, 127 struct nfsd_file_mark, 128 nfm_mark)); |
129 mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); | 129 fsnotify_group_unlock(nfsd_file_fsnotify_group); |
130 if (nfm) { 131 fsnotify_put_mark(mark); 132 break; 133 } 134 /* Avoid soft lockup race with nfsd_file_mark_put() */ 135 fsnotify_destroy_mark(mark, nfsd_file_fsnotify_group); 136 fsnotify_put_mark(mark); | 130 if (nfm) { 131 fsnotify_put_mark(mark); 132 break; 133 } 134 /* Avoid soft lockup race with nfsd_file_mark_put() */ 135 fsnotify_destroy_mark(mark, nfsd_file_fsnotify_group); 136 fsnotify_put_mark(mark); |
137 } else 138 mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); | 137 } else { 138 fsnotify_group_unlock(nfsd_file_fsnotify_group); 139 } |
139 140 /* allocate a new nfm */ 141 new = kmem_cache_alloc(nfsd_file_mark_slab, GFP_KERNEL); 142 if (!new) 143 return NULL; 144 fsnotify_init_mark(&new->nfm_mark, nfsd_file_fsnotify_group); 145 new->nfm_mark.mask = FS_ATTRIB|FS_DELETE_SELF; 146 refcount_set(&new->nfm_ref, 1); --- 527 unchanged lines hidden (view full) --- 674 675 ret = lease_register_notifier(&nfsd_file_lease_notifier); 676 if (ret) { 677 pr_err("nfsd: unable to register lease notifier: %d\n", ret); 678 goto out_shrinker; 679 } 680 681 nfsd_file_fsnotify_group = fsnotify_alloc_group(&nfsd_file_fsnotify_ops, | 140 141 /* allocate a new nfm */ 142 new = kmem_cache_alloc(nfsd_file_mark_slab, GFP_KERNEL); 143 if (!new) 144 return NULL; 145 fsnotify_init_mark(&new->nfm_mark, nfsd_file_fsnotify_group); 146 new->nfm_mark.mask = FS_ATTRIB|FS_DELETE_SELF; 147 refcount_set(&new->nfm_ref, 1); --- 527 unchanged lines hidden (view full) --- 675 676 ret = lease_register_notifier(&nfsd_file_lease_notifier); 677 if (ret) { 678 pr_err("nfsd: unable to register lease notifier: %d\n", ret); 679 goto out_shrinker; 680 } 681 682 nfsd_file_fsnotify_group = fsnotify_alloc_group(&nfsd_file_fsnotify_ops, |
682 0); | 683 FSNOTIFY_GROUP_NOFS); |
683 if (IS_ERR(nfsd_file_fsnotify_group)) { 684 pr_err("nfsd: unable to create fsnotify group: %ld\n", 685 PTR_ERR(nfsd_file_fsnotify_group)); 686 ret = PTR_ERR(nfsd_file_fsnotify_group); 687 nfsd_file_fsnotify_group = NULL; 688 goto out_notifier; 689 } 690 --- 367 unchanged lines hidden --- | 684 if (IS_ERR(nfsd_file_fsnotify_group)) { 685 pr_err("nfsd: unable to create fsnotify group: %ld\n", 686 PTR_ERR(nfsd_file_fsnotify_group)); 687 ret = PTR_ERR(nfsd_file_fsnotify_group); 688 nfsd_file_fsnotify_group = NULL; 689 goto out_notifier; 690 } 691 --- 367 unchanged lines hidden --- |