Lines Matching refs:fl

156 enum partialfilelock_status lock_partialfilelock(struct file_lock *fl);
158 void send_granted(struct file_lock *fl, int opcode);
170 void deallocate_file_lock(struct file_lock *fl);
171 void fill_file_lock(struct file_lock *fl, const fhandle_t *fh,
189 void dump_filelock(const struct file_lock *fl);
190 struct file_lock * get_lock_matching_unlock(const struct file_lock *fl);
191 enum nfslock_status test_nfslock(const struct file_lock *fl,
193 enum nfslock_status lock_nfslock(struct file_lock *fl);
194 enum nfslock_status delete_nfslock(struct file_lock *fl);
195 enum nfslock_status unlock_nfslock(const struct file_lock *fl,
198 enum hwlock_status lock_hwlock(struct file_lock *fl);
202 int duplicate_block(struct file_lock *fl);
203 void add_blockingfilelock(struct file_lock *fl);
204 enum hwlock_status unlock_hwlock(const struct file_lock *fl);
205 enum hwlock_status test_hwlock(const struct file_lock *fl,
207 void remove_blockingfilelock(struct file_lock *fl);
211 const struct file_lock *fl);
214 const struct file_lock *fl, struct file_lock **conflicting_fl);
215 enum nlm_stats do_test(struct file_lock *fl,
217 enum nlm_stats do_unlock(struct file_lock *fl);
218 enum nlm_stats do_lock(struct file_lock *fl);
319 dump_filelock(const struct file_lock *fl) in dump_filelock() argument
330 if (fl != NULL) { in dump_filelock()
331 debuglog("Dumping file lock structure @ %p\n", fl); in dump_filelock()
334 dump_static_object((unsigned char *)&fl->filehandle, in dump_filelock()
335 sizeof(fl->filehandle), hbuff, sizeof(hbuff), in dump_filelock()
342 fl->client.exclusive, fl->client.svid, in dump_filelock()
343 fl->client.l_offset, fl->client.l_len); in dump_filelock()
347 dump_netobj(&fl->client.oh); in dump_filelock()
350 dump_netobj(&fl->client_cookie); in dump_filelock()
353 " client_name: %s\n", fl->nsm_status, fl->status, in dump_filelock()
354 fl->flags, fl->client.svid, fl->client_name); in dump_filelock()
445 fill_file_lock(struct file_lock *fl, const fhandle_t *fh, in fill_file_lock() argument
450 bcopy(fh, &fl->filehandle, sizeof(fhandle_t)); in fill_file_lock()
452 fl->client.exclusive = exclusive; in fill_file_lock()
453 fl->client.svid = svid; in fill_file_lock()
454 fl->client.l_offset = offset; in fill_file_lock()
455 fl->client.l_len = len; in fill_file_lock()
457 fl->nsm_status = state; in fill_file_lock()
458 fl->status = status; in fill_file_lock()
459 fl->flags = flags; in fill_file_lock()
460 fl->blocking = blocking; in fill_file_lock()
467 deallocate_file_lock(struct file_lock *fl) in deallocate_file_lock() argument
469 free(fl->addr); in deallocate_file_lock()
470 free(fl->client.oh.n_bytes); in deallocate_file_lock()
471 free(fl->client_cookie.n_bytes); in deallocate_file_lock()
472 free(fl); in deallocate_file_lock()
726 get_lock_matching_unlock(const struct file_lock *fl) in get_lock_matching_unlock() argument
732 dump_filelock(fl); in get_lock_matching_unlock()
747 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in get_lock_matching_unlock()
754 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in get_lock_matching_unlock()
760 fl->client.l_offset,fl->client.l_len, in get_lock_matching_unlock()
764 if (!same_filelock_identity(fl,ifl)) in get_lock_matching_unlock()
790 test_nfslock(const struct file_lock *fl, struct file_lock **conflicting_fl) in test_nfslock() argument
805 dump_filelock(fl); in test_nfslock()
827 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in test_nfslock()
833 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in test_nfslock()
839 fl->client.l_offset,fl->client.l_len, in test_nfslock()
843 if (!(fl->client.exclusive || ifl->client.exclusive)) in test_nfslock()
847 fl->client.exclusive, in test_nfslock()
850 if (same_filelock_identity(fl,ifl)) { in test_nfslock()
858 dump_filelock(fl); in test_nfslock()
891 lock_nfslock(struct file_lock *fl) in lock_nfslock() argument
900 retval = test_nfslock(fl,&dummy_fl); in lock_nfslock()
904 dump_filelock(fl); in lock_nfslock()
905 LIST_INSERT_HEAD(&nfslocklist_head, fl, nfslocklist); in lock_nfslock()
925 delete_nfslock(struct file_lock *fl) in delete_nfslock() argument
928 LIST_REMOVE(fl, nfslocklist); in delete_nfslock()
980 unlock_nfslock(fl, released_lock, left_lock, right_lock) in unlock_nfslock() argument
981 const struct file_lock *fl; in unlock_nfslock()
999 mfl = get_lock_matching_unlock(fl);
1004 spstatus = split_nfslock(mfl, fl, left_lock, right_lock);
1006 debuglog("Split returned %d %p %p %p %p\n",spstatus,mfl,fl,*left_lock,*right_lock);
1009 dump_filelock(fl);
1055 lock_hwlock(struct file_lock *fl) in lock_hwlock() argument
1062 if (bcmp(&fl->filehandle, &imf->filehandle, in lock_hwlock()
1063 sizeof(fl->filehandle)) == 0) { in lock_hwlock()
1087 nmf->fd = fhopen(&fl->filehandle, O_RDWR); in lock_hwlock()
1090 fl->client_name, strerror(errno)); in lock_hwlock()
1103 bcopy(&fl->filehandle, &nmf->filehandle, sizeof(fl->filehandle)); in lock_hwlock()
1105 nmf->exclusive = fl->client.exclusive; in lock_hwlock()
1114 fl->client_name, strerror(errno)); in lock_hwlock()
1133 debuglog("flock succeeded (from %16s)\n", fl->client_name); in lock_hwlock()
1138 unlock_hwlock(const struct file_lock *fl) in unlock_hwlock() argument
1147 if (bcmp(&fl->filehandle, &imf->filehandle, in unlock_hwlock()
1148 sizeof(fl->filehandle)) == 0) { in unlock_hwlock()
1179 test_hwlock(fl, conflicting_fl) in test_hwlock() argument
1180 const struct file_lock *fl __unused; in test_hwlock()
1200 duplicate_block(struct file_lock *fl) in duplicate_block() argument
1213 if (!bcmp(&fl->filehandle, &ifl->filehandle, in duplicate_block()
1215 fl->client.exclusive == ifl->client.exclusive && in duplicate_block()
1216 fl->client.l_offset == ifl->client.l_offset && in duplicate_block()
1217 fl->client.l_len == ifl->client.l_len && in duplicate_block()
1218 same_filelock_identity(fl, ifl)) { in duplicate_block()
1230 add_blockingfilelock(struct file_lock *fl) in add_blockingfilelock() argument
1241 if (duplicate_block(fl)) { in add_blockingfilelock()
1251 fl->blocking = 0; in add_blockingfilelock()
1252 LIST_INSERT_HEAD(&blockedlocklist_head, fl, nfslocklist); in add_blockingfilelock()
1258 remove_blockingfilelock(struct file_lock *fl) in remove_blockingfilelock() argument
1263 LIST_REMOVE(fl, nfslocklist); in remove_blockingfilelock()
1364 lock_partialfilelock(struct file_lock *fl) in lock_partialfilelock() argument
1379 lnlstatus = lock_nfslock(fl); in lock_partialfilelock()
1388 hwstatus = lock_hwlock(fl); in lock_partialfilelock()
1404 monitor_lock_host(fl->client_name); in lock_partialfilelock()
1423 delete_nfslock(fl); in lock_partialfilelock()
1446 if (fl->blocking == 1) { in lock_partialfilelock()
1451 add_blockingfilelock(fl); in lock_partialfilelock()
1452 dump_filelock(fl); in lock_partialfilelock()
1456 dump_filelock(fl); in lock_partialfilelock()
1461 dump_filelock(fl); in lock_partialfilelock()
1480 unlock_partialfilelock(const struct file_lock *fl) in unlock_partialfilelock() argument
1520 unlstatus = unlock_nfslock(fl, &releasedfl, &lfl, &rfl); in unlock_partialfilelock()
1549 unlhwstatus = unlock_hwlock(fl); in unlock_partialfilelock()
1584 dump_filelock(fl); in unlock_partialfilelock()
1589 if (fl == releasedfl) { in unlock_partialfilelock()
1671 test_partialfilelock(const struct file_lock *fl, in test_partialfilelock() argument
1681 teststatus = test_nfslock(fl, conflicting_fl); in test_partialfilelock()
1689 dump_filelock(fl); in test_partialfilelock()
1695 dump_filelock(fl); in test_partialfilelock()
1716 do_test(struct file_lock *fl, struct file_lock **conflicting_fl) in do_test() argument
1723 pfsret = test_partialfilelock(fl,conflicting_fl); in do_test()
1728 dump_filelock(fl); in do_test()
1730 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1734 dump_filelock(fl); in do_test()
1738 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1743 dump_filelock(fl); in do_test()
1745 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_test()
1750 dump_filelock(fl); in do_test()
1752 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_test()
1756 dump_filelock(fl); in do_test()
1758 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_test()
1775 do_lock(struct file_lock *fl) in do_lock() argument
1782 pfsret = lock_partialfilelock(fl); in do_lock()
1787 dump_filelock(fl); in do_lock()
1788 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1792 dump_filelock(fl); in do_lock()
1793 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1798 dump_filelock(fl); in do_lock()
1799 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_lock()
1804 dump_filelock(fl); in do_lock()
1805 retval = (fl->flags & LOCK_V4) ? nlm4_blocked : nlm_blocked; in do_lock()
1810 dump_filelock(fl); in do_lock()
1811 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_lock()
1815 dump_filelock(fl); in do_lock()
1816 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_lock()
1826 do_unlock(struct file_lock *fl) in do_unlock() argument
1832 pfsret = unlock_partialfilelock(fl); in do_unlock()
1837 dump_filelock(fl); in do_unlock()
1838 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1843 dump_filelock(fl); in do_unlock()
1844 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_unlock()
1849 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1854 dump_filelock(fl); in do_unlock()
1855 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_unlock()
1859 dump_filelock(fl); in do_unlock()
1860 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_unlock()
1999 struct file_lock fl; in unlock() local
2006 bzero(&fl,sizeof(struct file_lock)); in unlock()
2007 bcopy(lock->fh.n_bytes, &fl.filehandle, sizeof(fhandle_t)); in unlock()
2009 copy_nlm4_lock_to_nlm4_holder(lock, 0, &fl.client); in unlock()
2011 err = do_unlock(&fl); in unlock()
2191 send_granted(fl, opcode) in send_granted() argument
2192 struct file_lock *fl; in send_granted()
2204 cli = get_client(fl->addr,
2205 (fl->flags & LOCK_V4) ? NLM_VERS4 : NLM_VERS);
2208 fl->client_name);
2217 timeo.tv_usec = (fl->flags & LOCK_ASYNC) ? 0 : 500000; /* 0.5s */
2219 if (fl->flags & LOCK_V4) {
2221 res.cookie = fl->client_cookie;
2222 res.exclusive = fl->client.exclusive;
2223 res.alock.caller_name = fl->client_name;
2225 res.alock.fh.n_bytes = (char*)&fl->filehandle;
2226 res.alock.oh = fl->client.oh;
2227 res.alock.svid = fl->client.svid;
2228 res.alock.l_offset = fl->client.l_offset;
2229 res.alock.l_len = fl->client.l_len;
2231 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2232 if (fl->flags & LOCK_ASYNC) {
2244 res.cookie = fl->client_cookie;
2245 res.exclusive = fl->client.exclusive;
2246 res.alock.caller_name = fl->client_name;
2248 res.alock.fh.n_bytes = (char*)&fl->filehandle;
2249 res.alock.oh = fl->client.oh;
2250 res.alock.svid = fl->client.svid;
2251 res.alock.l_offset = fl->client.l_offset;
2252 res.alock.l_len = fl->client.l_len;
2254 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2255 if (fl->flags & LOCK_ASYNC) {