Lines Matching refs:fl
154 enum partialfilelock_status lock_partialfilelock(struct file_lock *fl);
156 void send_granted(struct file_lock *fl, int opcode);
168 void deallocate_file_lock(struct file_lock *fl);
169 void fill_file_lock(struct file_lock *fl, const fhandle_t *fh,
187 void dump_filelock(const struct file_lock *fl);
188 struct file_lock * get_lock_matching_unlock(const struct file_lock *fl);
189 enum nfslock_status test_nfslock(const struct file_lock *fl,
191 enum nfslock_status lock_nfslock(struct file_lock *fl);
192 enum nfslock_status delete_nfslock(struct file_lock *fl);
193 enum nfslock_status unlock_nfslock(const struct file_lock *fl,
196 enum hwlock_status lock_hwlock(struct file_lock *fl);
200 int duplicate_block(struct file_lock *fl);
201 void add_blockingfilelock(struct file_lock *fl);
202 enum hwlock_status unlock_hwlock(const struct file_lock *fl);
203 enum hwlock_status test_hwlock(const struct file_lock *fl,
205 void remove_blockingfilelock(struct file_lock *fl);
209 const struct file_lock *fl);
212 const struct file_lock *fl, struct file_lock **conflicting_fl);
213 enum nlm_stats do_test(struct file_lock *fl,
215 enum nlm_stats do_unlock(struct file_lock *fl);
216 enum nlm_stats do_lock(struct file_lock *fl);
312 dump_filelock(const struct file_lock *fl) in dump_filelock() argument
323 if (fl != NULL) { in dump_filelock()
324 debuglog("Dumping file lock structure @ %p\n", fl); in dump_filelock()
327 dump_static_object((unsigned char *)&fl->filehandle, in dump_filelock()
328 sizeof(fl->filehandle), hbuff, sizeof(hbuff), in dump_filelock()
335 fl->client.exclusive, fl->client.svid, in dump_filelock()
336 fl->client.l_offset, fl->client.l_len); in dump_filelock()
340 dump_netobj(&fl->client.oh); in dump_filelock()
343 dump_netobj(&fl->client_cookie); in dump_filelock()
346 " client_name: %s\n", fl->nsm_status, fl->status, in dump_filelock()
347 fl->flags, fl->client.svid, fl->client_name); in dump_filelock()
425 fill_file_lock(struct file_lock *fl, const fhandle_t *fh, in fill_file_lock() argument
430 bcopy(fh, &fl->filehandle, sizeof(fhandle_t)); in fill_file_lock()
432 fl->client.exclusive = exclusive; in fill_file_lock()
433 fl->client.svid = svid; in fill_file_lock()
434 fl->client.l_offset = offset; in fill_file_lock()
435 fl->client.l_len = len; in fill_file_lock()
437 fl->nsm_status = state; in fill_file_lock()
438 fl->status = status; in fill_file_lock()
439 fl->flags = flags; in fill_file_lock()
440 fl->blocking = blocking; in fill_file_lock()
447 deallocate_file_lock(struct file_lock *fl) in deallocate_file_lock() argument
449 free(fl->addr); in deallocate_file_lock()
450 free(fl->client.oh.n_bytes); in deallocate_file_lock()
451 free(fl->client_cookie.n_bytes); in deallocate_file_lock()
452 free(fl); in deallocate_file_lock()
704 get_lock_matching_unlock(const struct file_lock *fl) in get_lock_matching_unlock() argument
710 dump_filelock(fl); in get_lock_matching_unlock()
725 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in get_lock_matching_unlock()
732 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in get_lock_matching_unlock()
738 fl->client.l_offset,fl->client.l_len, in get_lock_matching_unlock()
742 if (!same_filelock_identity(fl,ifl)) in get_lock_matching_unlock()
768 test_nfslock(const struct file_lock *fl, struct file_lock **conflicting_fl) in test_nfslock() argument
783 dump_filelock(fl); in test_nfslock()
805 if (bcmp(&fl->filehandle, &ifl->filehandle, sizeof(fhandle_t))) in test_nfslock()
811 if (!regions_overlap(fl->client.l_offset, fl->client.l_len, in test_nfslock()
817 fl->client.l_offset,fl->client.l_len, in test_nfslock()
821 if (!(fl->client.exclusive || ifl->client.exclusive)) in test_nfslock()
825 fl->client.exclusive, in test_nfslock()
828 if (same_filelock_identity(fl,ifl)) { in test_nfslock()
836 dump_filelock(fl); in test_nfslock()
869 lock_nfslock(struct file_lock *fl) in lock_nfslock() argument
878 retval = test_nfslock(fl,&dummy_fl); in lock_nfslock()
882 dump_filelock(fl); in lock_nfslock()
883 LIST_INSERT_HEAD(&nfslocklist_head, fl, nfslocklist); in lock_nfslock()
903 delete_nfslock(struct file_lock *fl) in delete_nfslock() argument
906 LIST_REMOVE(fl, nfslocklist); in delete_nfslock()
958 unlock_nfslock(const struct file_lock *fl, struct file_lock **released_lock, in unlock_nfslock() argument
974 mfl = get_lock_matching_unlock(fl); in unlock_nfslock()
979 spstatus = split_nfslock(mfl, fl, left_lock, right_lock); in unlock_nfslock()
981 debuglog("Split returned %d %p %p %p %p\n",spstatus,mfl,fl,*left_lock,*right_lock); in unlock_nfslock()
984 dump_filelock(fl); in unlock_nfslock()
1030 lock_hwlock(struct file_lock *fl) in lock_hwlock() argument
1037 if (bcmp(&fl->filehandle, &imf->filehandle, in lock_hwlock()
1038 sizeof(fl->filehandle)) == 0) { in lock_hwlock()
1062 nmf->fd = fhopen(&fl->filehandle, O_RDWR); in lock_hwlock()
1065 fl->client_name, strerror(errno)); in lock_hwlock()
1078 bcopy(&fl->filehandle, &nmf->filehandle, sizeof(fl->filehandle)); in lock_hwlock()
1080 nmf->exclusive = fl->client.exclusive; in lock_hwlock()
1089 fl->client_name, strerror(errno)); in lock_hwlock()
1108 debuglog("flock succeeded (from %16s)\n", fl->client_name); in lock_hwlock()
1113 unlock_hwlock(const struct file_lock *fl) in unlock_hwlock() argument
1122 if (bcmp(&fl->filehandle, &imf->filehandle, in unlock_hwlock()
1123 sizeof(fl->filehandle)) == 0) { in unlock_hwlock()
1154 test_hwlock(const struct file_lock *fl __unused, in test_hwlock()
1174 duplicate_block(struct file_lock *fl) in duplicate_block() argument
1187 if (!bcmp(&fl->filehandle, &ifl->filehandle, in duplicate_block()
1189 fl->client.exclusive == ifl->client.exclusive && in duplicate_block()
1190 fl->client.l_offset == ifl->client.l_offset && in duplicate_block()
1191 fl->client.l_len == ifl->client.l_len && in duplicate_block()
1192 same_filelock_identity(fl, ifl)) { in duplicate_block()
1204 add_blockingfilelock(struct file_lock *fl) in add_blockingfilelock() argument
1215 if (duplicate_block(fl)) { in add_blockingfilelock()
1225 fl->blocking = 0; in add_blockingfilelock()
1226 LIST_INSERT_HEAD(&blockedlocklist_head, fl, nfslocklist); in add_blockingfilelock()
1232 remove_blockingfilelock(struct file_lock *fl) in remove_blockingfilelock() argument
1237 LIST_REMOVE(fl, nfslocklist); in remove_blockingfilelock()
1338 lock_partialfilelock(struct file_lock *fl) in lock_partialfilelock() argument
1353 lnlstatus = lock_nfslock(fl); in lock_partialfilelock()
1362 hwstatus = lock_hwlock(fl); in lock_partialfilelock()
1378 monitor_lock_host(fl->client_name); in lock_partialfilelock()
1397 delete_nfslock(fl); in lock_partialfilelock()
1420 if (fl->blocking == 1) { in lock_partialfilelock()
1425 add_blockingfilelock(fl); in lock_partialfilelock()
1426 dump_filelock(fl); in lock_partialfilelock()
1430 dump_filelock(fl); in lock_partialfilelock()
1435 dump_filelock(fl); in lock_partialfilelock()
1454 unlock_partialfilelock(const struct file_lock *fl) in unlock_partialfilelock() argument
1494 unlstatus = unlock_nfslock(fl, &releasedfl, &lfl, &rfl); in unlock_partialfilelock()
1523 unlhwstatus = unlock_hwlock(fl); in unlock_partialfilelock()
1558 dump_filelock(fl); in unlock_partialfilelock()
1563 if (fl == releasedfl) { in unlock_partialfilelock()
1645 test_partialfilelock(const struct file_lock *fl, in test_partialfilelock() argument
1655 teststatus = test_nfslock(fl, conflicting_fl); in test_partialfilelock()
1663 dump_filelock(fl); in test_partialfilelock()
1669 dump_filelock(fl); in test_partialfilelock()
1690 do_test(struct file_lock *fl, struct file_lock **conflicting_fl) in do_test() argument
1697 pfsret = test_partialfilelock(fl,conflicting_fl); in do_test()
1702 dump_filelock(fl); in do_test()
1704 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1708 dump_filelock(fl); in do_test()
1712 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_test()
1717 dump_filelock(fl); in do_test()
1719 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_test()
1724 dump_filelock(fl); in do_test()
1726 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_test()
1730 dump_filelock(fl); in do_test()
1732 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_test()
1749 do_lock(struct file_lock *fl) in do_lock() argument
1756 pfsret = lock_partialfilelock(fl); in do_lock()
1761 dump_filelock(fl); in do_lock()
1762 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1766 dump_filelock(fl); in do_lock()
1767 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_lock()
1772 dump_filelock(fl); in do_lock()
1773 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_lock()
1778 dump_filelock(fl); in do_lock()
1779 retval = (fl->flags & LOCK_V4) ? nlm4_blocked : nlm_blocked; in do_lock()
1784 dump_filelock(fl); in do_lock()
1785 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_lock()
1789 dump_filelock(fl); in do_lock()
1790 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_lock()
1800 do_unlock(struct file_lock *fl) in do_unlock() argument
1806 pfsret = unlock_partialfilelock(fl); in do_unlock()
1811 dump_filelock(fl); in do_unlock()
1812 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1817 dump_filelock(fl); in do_unlock()
1818 retval = (fl->flags & LOCK_V4) ? nlm4_denied : nlm_denied; in do_unlock()
1823 retval = (fl->flags & LOCK_V4) ? nlm4_granted : nlm_granted; in do_unlock()
1828 dump_filelock(fl); in do_unlock()
1829 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : nlm_denied_nolocks; in do_unlock()
1833 dump_filelock(fl); in do_unlock()
1834 retval = (fl->flags & LOCK_V4) ? nlm4_failed : nlm_denied; in do_unlock()
1973 struct file_lock fl; in unlock() local
1980 bzero(&fl,sizeof(struct file_lock)); in unlock()
1981 bcopy(lock->fh.n_bytes, &fl.filehandle, sizeof(fhandle_t)); in unlock()
1983 copy_nlm4_lock_to_nlm4_holder(lock, 0, &fl.client); in unlock()
1985 err = do_unlock(&fl); in unlock()
2165 send_granted(struct file_lock *fl, int opcode __unused) in send_granted() argument
2176 cli = get_client(fl->addr, in send_granted()
2177 (fl->flags & LOCK_V4) ? NLM_VERS4 : NLM_VERS); in send_granted()
2180 fl->client_name); in send_granted()
2189 timeo.tv_usec = (fl->flags & LOCK_ASYNC) ? 0 : 500000; /* 0.5s */ in send_granted()
2191 if (fl->flags & LOCK_V4) { in send_granted()
2193 res.cookie = fl->client_cookie; in send_granted()
2194 res.exclusive = fl->client.exclusive; in send_granted()
2195 res.alock.caller_name = fl->client_name; in send_granted()
2197 res.alock.fh.n_bytes = (char*)&fl->filehandle; in send_granted()
2198 res.alock.oh = fl->client.oh; in send_granted()
2199 res.alock.svid = fl->client.svid; in send_granted()
2200 res.alock.l_offset = fl->client.l_offset; in send_granted()
2201 res.alock.l_len = fl->client.l_len; in send_granted()
2203 (fl->flags & LOCK_ASYNC) ? " (async)":""); in send_granted()
2204 if (fl->flags & LOCK_ASYNC) { in send_granted()
2216 res.cookie = fl->client_cookie; in send_granted()
2217 res.exclusive = fl->client.exclusive; in send_granted()
2218 res.alock.caller_name = fl->client_name; in send_granted()
2220 res.alock.fh.n_bytes = (char*)&fl->filehandle; in send_granted()
2221 res.alock.oh = fl->client.oh; in send_granted()
2222 res.alock.svid = fl->client.svid; in send_granted()
2223 res.alock.l_offset = fl->client.l_offset; in send_granted()
2224 res.alock.l_len = fl->client.l_len; in send_granted()
2226 (fl->flags & LOCK_ASYNC) ? " (async)":""); in send_granted()
2227 if (fl->flags & LOCK_ASYNC) { in send_granted()