filecache.c (f83d9396d1f63048c423efa00e4e244da10a35fd) filecache.c (23ba98de6dcec665e15c0ca19244379bb0d30932)
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>

--- 170 unchanged lines hidden (view full) ---

179 nf->nf_file = NULL;
180 nf->nf_cred = get_current_cred();
181 nf->nf_net = net;
182 nf->nf_flags = 0;
183 nf->nf_inode = inode;
184 nf->nf_hashval = hashval;
185 refcount_set(&nf->nf_ref, 1);
186 nf->nf_may = may & NFSD_FILE_MAY_MASK;
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>

--- 170 unchanged lines hidden (view full) ---

179 nf->nf_file = NULL;
180 nf->nf_cred = get_current_cred();
181 nf->nf_net = net;
182 nf->nf_flags = 0;
183 nf->nf_inode = inode;
184 nf->nf_hashval = hashval;
185 refcount_set(&nf->nf_ref, 1);
186 nf->nf_may = may & NFSD_FILE_MAY_MASK;
187 if (may & NFSD_MAY_NOT_BREAK_LEASE) {
188 if (may & NFSD_MAY_WRITE)
189 __set_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags);
190 if (may & NFSD_MAY_READ)
191 __set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags);
192 }
193 nf->nf_mark = NULL;
194 trace_nfsd_file_alloc(nf);
195 }
196 return nf;
197}
198
199static bool
200nfsd_file_free(struct nfsd_file *nf)

--- 752 unchanged lines hidden (view full) ---

953 }
954 retry = false;
955 nfsd_file_put_noref(nf);
956 goto retry;
957 }
958
959 this_cpu_inc(nfsd_file_cache_hits);
960
187 nf->nf_mark = NULL;
188 trace_nfsd_file_alloc(nf);
189 }
190 return nf;
191}
192
193static bool
194nfsd_file_free(struct nfsd_file *nf)

--- 752 unchanged lines hidden (view full) ---

947 }
948 retry = false;
949 nfsd_file_put_noref(nf);
950 goto retry;
951 }
952
953 this_cpu_inc(nfsd_file_cache_hits);
954
961 if (!(may_flags & NFSD_MAY_NOT_BREAK_LEASE)) {
962 bool write = (may_flags & NFSD_MAY_WRITE);
963
964 if (test_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags) ||
965 (test_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags) && write)) {
966 status = nfserrno(nfsd_open_break_lease(
967 file_inode(nf->nf_file), may_flags));
968 if (status == nfs_ok) {
969 clear_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags);
970 if (write)
971 clear_bit(NFSD_FILE_BREAK_WRITE,
972 &nf->nf_flags);
973 }
974 }
975 }
955 status = nfserrno(nfsd_open_break_lease(file_inode(nf->nf_file), may_flags));
976out:
977 if (status == nfs_ok) {
978 *pnf = nf;
979 } else {
980 nfsd_file_put(nf);
981 nf = NULL;
982 }
983

--- 116 unchanged lines hidden ---
956out:
957 if (status == nfs_ok) {
958 *pnf = nf;
959 } else {
960 nfsd_file_put(nf);
961 nf = NULL;
962 }
963

--- 116 unchanged lines hidden ---