Lines Matching refs:fl

207 enum partialfilelock_status lock_partialfilelock(struct file_lock *fl);
209 int send_granted(struct file_lock *fl, int opcode);
220 void deallocate_file_lock(struct file_lock *fl);
221 void fill_file_lock(struct file_lock *fl,
239 void dump_filelock(const struct file_lock *fl);
240 struct file_lock * get_lock_matching_unlock(const struct file_lock *fl, int cleanup);
241 enum nfslock_status test_nfslock(const struct file_lock *fl,
243 enum nfslock_status lock_nfslock(struct file_lock *fl);
244 enum nfslock_status delete_nfslock(struct file_lock *fl);
245 enum nfslock_status unlock_nfslock(const struct file_lock *fl,
248 enum hwlock_status lock_hwlock(struct file_lock *fl);
252 void add_blockingfilelock(struct file_lock *fl);
253 enum hwlock_status unlock_hwlock(const struct file_lock *fl);
254 enum hwlock_status test_hwlock(const struct file_lock *fl,
256 void remove_blockingfilelock(struct file_lock *fl);
260 const struct file_lock *fl, int cleanup);
263 const struct file_lock *fl, struct file_lock **conflicting_fl);
264 enum nlm4_stats do_test(struct file_lock *fl, struct file_lock **conflicting_fl);
265 enum nlm4_stats do_unlock(struct file_lock *fl);
266 enum nlm4_stats do_lock(struct file_lock *fl);
372 dump_filelock(const struct file_lock *fl)
383 if (fl != NULL) {
384 debuglog("Dumping file lock structure @ %p\n", fl);
387 dump_static_object((unsigned char *)&fl->filehandle.n_bytes,
388 fl->filehandle.n_len, hbuff, sizeof(hbuff),
395 fl->client.exclusive, fl->client.svid,
396 fl->client.l_offset, fl->client.l_len);
400 dump_netobj(&fl->client.oh);
403 " fd: %d\n", fl->nsm_status, fl->status,
404 fl->flags, fl->locker, fl->fd);
484 fill_file_lock(struct file_lock *fl,
489 fl->client.exclusive = exclusive;
490 fl->client.svid = svid;
491 fl->client.l_offset = offset;
492 fl->client.l_len = len;
494 fl->nsm_status = state;
495 fl->status = status;
496 fl->flags = flags;
497 fl->blocking = blocking;
504 deallocate_file_lock(struct file_lock *fl)
506 free(fl->addr);
507 free(fl->client.oh.n_bytes);
508 free(fl->filehandle.n_bytes);
509 free(fl);
765 get_lock_matching_unlock(const struct file_lock *fl, int cleanup)
770 debuglog("********Dump of fl*****************\n");
771 dump_filelock(fl);
780 if (cleanup && (ifl == fl)) /* don't match the lock we're cleaning up under */
789 if (fl->filehandle.n_len != ifl->filehandle.n_len)
791 if (bcmp(fl->filehandle.n_bytes, ifl->filehandle.n_bytes,
792 fl->filehandle.n_len))
799 if (!regions_overlap(fl->client.l_offset, fl->client.l_len,
805 fl->client.l_offset,fl->client.l_len,
809 if (!same_filelock_identity(fl,ifl))
835 test_nfslock(const struct file_lock *fl, struct file_lock **conflicting_fl)
850 dump_filelock(fl);
872 if (fl->filehandle.n_len != ifl->filehandle.n_len)
874 if (bcmp(fl->filehandle.n_bytes, ifl->filehandle.n_bytes,
875 fl->filehandle.n_len))
881 if (!regions_overlap(fl->client.l_offset, fl->client.l_len,
887 fl->client.l_offset,fl->client.l_len,
891 if (!(fl->client.exclusive || ifl->client.exclusive))
895 fl->client.exclusive,
898 if (same_filelock_identity(fl,ifl)) {
906 dump_filelock(fl);
926 * Argument fl gets modified as its list housekeeping entries get modified
939 lock_nfslock(struct file_lock *fl)
948 retval = test_nfslock(fl,&dummy_fl);
952 dump_filelock(fl);
953 LIST_INSERT_HEAD(&nfslocklist_head, fl, nfslocklist);
973 delete_nfslock(struct file_lock *fl)
976 LIST_REMOVE(fl, nfslocklist);
1028 unlock_nfslock(fl, released_lock, left_lock, right_lock, cleanup)
1029 const struct file_lock *fl;
1048 mfl = get_lock_matching_unlock(fl, cleanup);
1053 spstatus = split_nfslock(mfl, fl, left_lock, right_lock);
1055 debuglog("Split returned %d %p %p %p %p\n",spstatus,mfl,fl,*left_lock,*right_lock);
1058 dump_filelock(fl);
1104 lock_hwlock(struct file_lock *fl)
1112 if ((fl->filehandle.n_len == imf->filehandle.n_len) &&
1113 (bcmp(fl->filehandle.n_bytes, imf->filehandle.n_bytes,
1114 fl->filehandle.n_len) == 0)) {
1136 nmf->filehandle.n_bytes = malloc(fl->filehandle.n_len);
1143 if (fl->filehandle.n_len > NFSV3_MAX_FH_SIZE) {
1145 fl->filehandle.n_len, fl->client_name, strerror(errno));
1150 fh.fh_len = fl->filehandle.n_len;
1151 bcopy(fl->filehandle.n_bytes, fh.fh_data, fh.fh_len);
1155 if ((nmf->fd < 0) && (errno == EROFS) && !fl->client.exclusive)
1159 fl->client_name, strerror(errno));
1173 nmf->filehandle.n_len = fl->filehandle.n_len;
1174 bcopy(fl->filehandle.n_bytes, nmf->filehandle.n_bytes, fl->filehandle.n_len);
1176 nmf->exclusive = fl->client.exclusive;
1185 fl->client_name, strerror(errno));
1205 debuglog("flock succeeded (from %16s)\n", fl->client_name);
1210 unlock_hwlock(const struct file_lock *fl)
1219 if ((fl->filehandle.n_len == imf->filehandle.n_len) &&
1220 (bcmp(fl->filehandle.n_bytes, imf->filehandle.n_bytes,
1221 fl->filehandle.n_len) == 0)) {
1253 test_hwlock(fl, conflicting_fl)
1254 const struct file_lock *fl __unused;
1274 add_blockingfilelock(struct file_lock *fl)
1293 if (fl->filehandle.n_len != ifl->filehandle.n_len)
1295 if (bcmp(fl->filehandle.n_bytes, ifl->filehandle.n_bytes,
1296 fl->filehandle.n_len))
1300 if ((fl->client.l_offset != ifl->client.l_offset) ||
1301 (fl->client.l_len != ifl->client.l_len))
1305 if (!same_filelock_identity(fl,ifl))
1319 fl->blocking = 0;
1320 LIST_INSERT_HEAD(&blockedlocklist_head, fl, nfslocklist);
1326 remove_blockingfilelock(struct file_lock *fl)
1331 LIST_REMOVE(fl, nfslocklist);
1492 * Argument fl gets modified as its list housekeeping entries get modified
1510 lock_partialfilelock(struct file_lock *fl)
1525 lnlstatus = lock_nfslock(fl);
1534 hwstatus = lock_hwlock(fl);
1550 if (fl->flags & LOCK_MON)
1551 monitor_lock_host_by_name(fl->client_name, fl->addr);
1582 delete_nfslock(fl);
1587 unlock_partialfilelock(fl, 1);
1603 * By the time fl reaches here, it is completely free again on
1610 if (fl->blocking == 1) {
1615 add_blockingfilelock(fl);
1616 dump_filelock(fl);
1620 dump_filelock(fl);
1625 dump_filelock(fl);
1648 unlock_partialfilelock(const struct file_lock *fl, int cleanup)
1687 unlstatus = unlock_nfslock(fl, &releasedfl, &lfl, &rfl, cleanup);
1718 unlhwstatus = unlock_hwlock(fl);
1759 dump_filelock(fl);
1764 if (fl == releasedfl) {
1790 * This statement wipes out the incoming file lock (fl)
1879 test_partialfilelock(const struct file_lock *fl,
1887 teststatus = test_nfslock(fl, conflicting_fl);
1895 dump_filelock(fl);
1901 dump_filelock(fl);
1922 do_test(struct file_lock *fl, struct file_lock **conflicting_fl)
1929 pfsret = test_partialfilelock(fl,conflicting_fl);
1934 dump_filelock(fl);
1936 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
1940 dump_filelock(fl);
1944 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
1949 dump_filelock(fl);
1951 retval = (fl->flags & LOCK_V4) ? nlm4_denied : (nlm4_stats) nlm_denied;
1956 dump_filelock(fl);
1958 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : (nlm4_stats) nlm_denied_nolocks;
1962 dump_filelock(fl);
1964 retval = (fl->flags & LOCK_V4) ? nlm4_failed : (nlm4_stats) nlm_denied;
1981 do_lock(struct file_lock *fl)
1988 pfsret = lock_partialfilelock(fl);
1993 dump_filelock(fl);
1994 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
1998 dump_filelock(fl);
1999 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
2004 dump_filelock(fl);
2005 retval = (fl->flags & LOCK_V4) ? nlm4_denied : (nlm4_stats) nlm_denied;
2010 dump_filelock(fl);
2011 retval = (fl->flags & LOCK_V4) ? nlm4_blocked : (nlm4_stats) nlm_blocked;
2018 dump_filelock(fl);
2019 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : (nlm4_stats) nlm_denied_nolocks;
2023 dump_filelock(fl);
2024 retval = (fl->flags & LOCK_V4) ? nlm4_stale_fh : (nlm4_stats) nlm_denied;
2028 dump_filelock(fl);
2029 retval = (fl->flags & LOCK_V4) ? nlm4_rofs : (nlm4_stats) nlm_denied;
2033 dump_filelock(fl);
2034 retval = (fl->flags & LOCK_V4) ? nlm4_failed : (nlm4_stats) nlm_denied;
2044 do_unlock(struct file_lock *fl)
2050 pfsret = unlock_partialfilelock(fl, 0);
2055 dump_filelock(fl);
2056 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
2061 dump_filelock(fl);
2062 retval = (fl->flags & LOCK_V4) ? nlm4_denied : (nlm4_stats) nlm_denied;
2067 retval = (fl->flags & LOCK_V4) ? nlm4_granted : (nlm4_stats) nlm_granted;
2072 dump_filelock(fl);
2073 retval = (fl->flags & LOCK_V4) ? nlm4_denied_nolocks : (nlm4_stats) nlm_denied_nolocks;
2077 dump_filelock(fl);
2078 retval = (fl->flags & LOCK_V4) ? nlm4_failed : (nlm4_stats) nlm_denied;
2289 struct file_lock fl;
2302 bzero(&fl,sizeof(struct file_lock));
2303 fl.filehandle.n_len = lock->fh.n_len;
2304 fl.filehandle.n_bytes = lock->fh.n_bytes;
2306 copy_nlm4_lock_to_nlm4_holder(lock, 0, &fl.client);
2308 err = do_unlock(&fl);
2718 send_granted(fl, opcode)
2719 struct file_lock *fl;
2731 cli = get_client(fl->addr, (fl->flags & LOCK_V4) ? NLM_VERS4 : NLM_VERS, 0, 0);
2734 fl->client_name);
2743 timeo.tv_usec = (fl->flags & LOCK_ASYNC) ? 0 : 500000; /* 0.5s */
2745 fl->granted_cookie = ++send_granted_cookie;
2749 if (fl->flags & LOCK_V4) {
2751 res.cookie.n_len = sizeof(fl->granted_cookie);
2752 res.cookie.n_bytes = (uint8_t*)&fl->granted_cookie;
2753 res.exclusive = fl->client.exclusive;
2754 res.alock.caller_name = fl->client_name;
2755 res.alock.fh.n_len = fl->filehandle.n_len;
2756 res.alock.fh.n_bytes = fl->filehandle.n_bytes;
2757 res.alock.oh = fl->client.oh;
2758 res.alock.svid = fl->client.svid;
2759 res.alock.l_offset = fl->client.l_offset;
2760 res.alock.l_len = fl->client.l_len;
2762 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2763 if (fl->flags & LOCK_ASYNC) {
2774 res.cookie.n_len = sizeof(fl->granted_cookie);
2775 res.cookie.n_bytes = (uint8_t*)&fl->granted_cookie;
2776 res.exclusive = fl->client.exclusive;
2777 res.alock.caller_name = fl->client_name;
2778 res.alock.fh.n_len = fl->filehandle.n_len;
2779 res.alock.fh.n_bytes = fl->filehandle.n_bytes;
2780 res.alock.oh = fl->client.oh;
2781 res.alock.svid = fl->client.svid;
2782 res.alock.l_offset = fl->client.l_offset;
2783 res.alock.l_len = fl->client.l_len;
2785 (fl->flags & LOCK_ASYNC) ? " (async)":"");
2786 if (fl->flags & LOCK_ASYNC) {
2800 !((fl->flags & LOCK_ASYNC) && (rv == RPC_TIMEDOUT)))