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);
318 dump_filelock(const struct file_lock *fl) in dump_filelock() argument
329 if (fl != NULL) { in dump_filelock()
330 debuglog("Dumping file lock structure @ %p\n", fl); in dump_filelock()
333 dump_static_object((unsigned char *)&fl->filehandle, in dump_filelock()
334 sizeof(fl->filehandle), hbuff, sizeof(hbuff), in dump_filelock()
341 fl->client.exclusive, fl->client.svid, in dump_filelock()
342 fl->client.l_offset, fl->client.l_len); in dump_filelock()
346 dump_netobj(&fl->client.oh); in dump_filelock()
349 dump_netobj(&fl->client_cookie); in dump_filelock()
352 " client_name: %s\n", fl->nsm_status, fl->status, in dump_filelock()
353 fl->flags, fl->client.svid, fl->client_name); in dump_filelock()
433 fill_file_lock(struct file_lock *fl, const fhandle_t *fh, in fill_file_lock() argument
438 bcopy(fh, &fl->filehandle, sizeof(fhandle_t)); in fill_file_lock()
440 fl->client.exclusive = exclusive; in fill_file_lock()
441 fl->client.svid = svid; in fill_file_lock()
442 fl->client.l_offset = offset; in fill_file_lock()
443 fl->client.l_len = len; in fill_file_lock()
445 fl->nsm_status = state; in fill_file_lock()
446 fl->status = status; in fill_file_lock()
447 fl->flags = flags; in fill_file_lock()
448 fl->blocking = blocking; in fill_file_lock()
455 deallocate_file_lock(struct file_lock *fl) in deallocate_file_lock() argument
457 free(fl->addr); in deallocate_file_lock()
458 free(fl->client.oh.n_bytes); in deallocate_file_lock()
459 free(fl->client_cookie.n_bytes); in deallocate_file_lock()
460 free(fl); in deallocate_file_lock()
714 get_lock_matching_unlock(const struct file_lock *fl) in get_lock_matching_unlock() argument
720 dump_filelock(fl); in get_lock_matching_unlock()
735 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in get_lock_matching_unlock()
742 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in get_lock_matching_unlock()
748 fl->client.l_offset,fl->client.l_len, in get_lock_matching_unlock()
752 if (!same_filelock_identity(fl,ifl)) in get_lock_matching_unlock()
778 test_nfslock(const struct file_lock *fl, struct file_lock **conflicting_fl) in test_nfslock() argument
793 dump_filelock(fl); in test_nfslock()
815 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in test_nfslock()
821 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in test_nfslock()
827 fl->client.l_offset,fl->client.l_len, in test_nfslock()
831 if (!(fl->client.exclusive || ifl->client.exclusive)) in test_nfslock()
835 fl->client.exclusive, in test_nfslock()
838 if (same_filelock_identity(fl,ifl)) { in test_nfslock()
846 dump_filelock(fl); in test_nfslock()
879 lock_nfslock(struct file_lock *fl) in lock_nfslock() argument
888 retval = test_nfslock(fl,&dummy_fl); in lock_nfslock()
892 dump_filelock(fl); in lock_nfslock()
893 LIST_INSERT_HEAD(&nfslocklist_head, fl, nfslocklist); in lock_nfslock()
913 delete_nfslock(struct file_lock *fl) in delete_nfslock() argument
916 LIST_REMOVE(fl, nfslocklist); in delete_nfslock()
968 unlock_nfslock(fl, released_lock, left_lock, right_lock) in unlock_nfslock() argument
969 const struct file_lock *fl; in unlock_nfslock()
987 mfl = get_lock_matching_unlock(fl);
992 spstatus = split_nfslock(mfl, fl, left_lock, right_lock);
994 debuglog("Split returned %d %p %p %p %p\n",spstatus,mfl,fl,*left_lock,*right_lock);
997 dump_filelock(fl);
1043 lock_hwlock(struct file_lock *fl) in lock_hwlock() argument
1050 if (bcmp(&fl->filehandle, &imf->filehandle, in lock_hwlock()
1051 sizeof(fl->filehandle)) == 0) { in lock_hwlock()
1075 nmf->fd = fhopen(&fl->filehandle, O_RDWR); in lock_hwlock()
1078 fl->client_name, strerror(errno)); in lock_hwlock()
1091 bcopy(&fl->filehandle, &nmf->filehandle, sizeof(fl->filehandle)); in lock_hwlock()
1093 nmf->exclusive = fl->client.exclusive; in lock_hwlock()
1102 fl->client_name, strerror(errno)); in lock_hwlock()
1121 debuglog("flock succeeded (from %16s)\n", fl->client_name); in lock_hwlock()
1126 unlock_hwlock(const struct file_lock *fl) in unlock_hwlock() argument
1135 if (bcmp(&fl->filehandle, &imf->filehandle, in unlock_hwlock()
1136 sizeof(fl->filehandle)) == 0) { in unlock_hwlock()
1167 test_hwlock(fl, conflicting_fl) in test_hwlock() argument
1168 const struct file_lock *fl __unused; in test_hwlock()
1188 duplicate_block(struct file_lock *fl) in duplicate_block() argument
1201 if (!bcmp(&fl->filehandle, &ifl->filehandle, in duplicate_block()
1203 fl->client.exclusive == ifl->client.exclusive && in duplicate_block()
1204 fl->client.l_offset == ifl->client.l_offset && in duplicate_block()
1205 fl->client.l_len == ifl->client.l_len && in duplicate_block()
1206 same_filelock_identity(fl, ifl)) { in duplicate_block()
1218 add_blockingfilelock(struct file_lock *fl) in add_blockingfilelock() argument
1229 if (duplicate_block(fl)) { in add_blockingfilelock()
1239 fl->blocking = 0; in add_blockingfilelock()
1240 LIST_INSERT_HEAD(&blockedlocklist_head, fl, nfslocklist); in add_blockingfilelock()
1246 remove_blockingfilelock(struct file_lock *fl) in remove_blockingfilelock() argument
1251 LIST_REMOVE(fl, nfslocklist); in remove_blockingfilelock()
1352 lock_partialfilelock(struct file_lock *fl) in lock_partialfilelock() argument
1367 lnlstatus = lock_nfslock(fl); in lock_partialfilelock()
1376 hwstatus = lock_hwlock(fl); in lock_partialfilelock()
1392 monitor_lock_host(fl->client_name); in lock_partialfilelock()
1411 delete_nfslock(fl); in lock_partialfilelock()
1434 if (fl->blocking == 1) { in lock_partialfilelock()
1439 add_blockingfilelock(fl); in lock_partialfilelock()
1440 dump_filelock(fl); in lock_partialfilelock()
1444 dump_filelock(fl); in lock_partialfilelock()
1449 dump_filelock(fl); in lock_partialfilelock()
1468 unlock_partialfilelock(const struct file_lock *fl) in unlock_partialfilelock() argument
1508 unlstatus = unlock_nfslock(fl, &releasedfl, &lfl, &rfl); in unlock_partialfilelock()
1537 unlhwstatus = unlock_hwlock(fl); in unlock_partialfilelock()
1572 dump_filelock(fl); in unlock_partialfilelock()
1577 if (fl == releasedfl) { in unlock_partialfilelock()
1659 test_partialfilelock(const struct file_lock *fl, in test_partialfilelock() argument
1669 teststatus = test_nfslock(fl, conflicting_fl); in test_partialfilelock()
1677 dump_filelock(fl); in test_partialfilelock()
1683 dump_filelock(fl); in test_partialfilelock()
1704 do_test(struct file_lock *fl, struct file_lock **conflicting_fl) in do_test() argument
1711 pfsret = test_partialfilelock(fl,conflicting_fl); in do_test()
1716 dump_filelock(fl); in do_test()
1718 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1722 dump_filelock(fl); in do_test()
1726 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1731 dump_filelock(fl); in do_test()
1733 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_test()
1738 dump_filelock(fl); in do_test()
1740 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_test()
1744 dump_filelock(fl); in do_test()
1746 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_test()
1763 do_lock(struct file_lock *fl) in do_lock() argument
1770 pfsret = lock_partialfilelock(fl); in do_lock()
1775 dump_filelock(fl); in do_lock()
1776 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1780 dump_filelock(fl); in do_lock()
1781 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1786 dump_filelock(fl); in do_lock()
1787 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_lock()
1792 dump_filelock(fl); in do_lock()
1793 retval = (fl->flags & LOCK_V4) ? nlm4_blocked : nlm_blocked; in do_lock()
1798 dump_filelock(fl); in do_lock()
1799 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_lock()
1803 dump_filelock(fl); in do_lock()
1804 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_lock()
1814 do_unlock(struct file_lock *fl) in do_unlock() argument
1820 pfsret = unlock_partialfilelock(fl); in do_unlock()
1825 dump_filelock(fl); in do_unlock()
1826 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1831 dump_filelock(fl); in do_unlock()
1832 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_unlock()
1837 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1842 dump_filelock(fl); in do_unlock()
1843 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_unlock()
1847 dump_filelock(fl); in do_unlock()
1848 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_unlock()
1987 struct file_lock fl; in unlock() local
1994 bzero(&fl,sizeof(struct file_lock)); in unlock()
1995 bcopy(lock->fh.n_bytes, &fl.filehandle, sizeof(fhandle_t)); in unlock()
1997 copy_nlm4_lock_to_nlm4_holder(lock, 0, &fl.client); in unlock()
1999 err = do_unlock(&fl); in unlock()
2179 send_granted(fl, opcode) in send_granted() argument
2180 struct file_lock *fl; in send_granted()
2192 cli = get_client(fl->addr,
2193 (fl->flags & LOCK_V4) ? NLM_VERS4 : NLM_VERS);
2196 fl->client_name);
2205 timeo.tv_usec = (fl->flags & LOCK_ASYNC) ? 0 : 500000; /* 0.5s */
2207 if (fl->flags & LOCK_V4) {
2209 res.cookie = fl->client_cookie;
2210 res.exclusive = fl->client.exclusive;
2211 res.alock.caller_name = fl->client_name;
2213 res.alock.fh.n_bytes = (char*)&fl->filehandle;
2214 res.alock.oh = fl->client.oh;
2215 res.alock.svid = fl->client.svid;
2216 res.alock.l_offset = fl->client.l_offset;
2217 res.alock.l_len = fl->client.l_len;
2219 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2220 if (fl->flags & LOCK_ASYNC) {
2232 res.cookie = fl->client_cookie;
2233 res.exclusive = fl->client.exclusive;
2234 res.alock.caller_name = fl->client_name;
2236 res.alock.fh.n_bytes = (char*)&fl->filehandle;
2237 res.alock.oh = fl->client.oh;
2238 res.alock.svid = fl->client.svid;
2239 res.alock.l_offset = fl->client.l_offset;
2240 res.alock.l_len = fl->client.l_len;
2242 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2243 if (fl->flags & LOCK_ASYNC) {