tag | line | file | source code |
fl | 76 | fs/locks.c | static int flock_make_lock(struct file *filp, struct file_lock *fl, |
fl | 78 | fs/locks.c | static int posix_make_lock(struct file *filp, struct file_lock *fl, |
fl | 93 | fs/locks.c | static struct file_lock *locks_alloc_lock(struct file_lock *fl); |
fl | 94 | fs/locks.c | static void locks_insert_lock(struct file_lock **pos, struct file_lock *fl); |
fl | 95 | fs/locks.c | static void locks_delete_lock(struct file_lock **fl, unsigned int wait); |
fl | 100 | fs/locks.c | static inline void locks_free_lock(struct file_lock **fl) |
fl | 102 | fs/locks.c | kfree(*fl); |
fl | 103 | fs/locks.c | *fl = NULL; /* Just in case */ |
fl | 121 | fs/locks.c | struct file_lock *fl) |
fl | 129 | fs/locks.c | *block = fl; |
fl | 130 | fs/locks.c | fl->fl_block = NULL; |
fl | 136 | fs/locks.c | struct file_lock *fl) |
fl | 141 | fs/locks.c | if (bfl == fl) { |
fl | 142 | fs/locks.c | *block = fl->fl_block; |
fl | 143 | fs/locks.c | fl->fl_block = NULL; |
fl | 178 | fs/locks.c | struct file_lock *fl,file_lock; |
fl | 194 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 195 | fs/locks.c | if (posix_locks_conflict(&file_lock, fl)) { |
fl | 196 | fs/locks.c | flock.l_pid = fl->fl_owner->pid; |
fl | 197 | fs/locks.c | flock.l_start = fl->fl_start; |
fl | 198 | fs/locks.c | flock.l_len = fl->fl_end == OFFSET_MAX ? 0 : |
fl | 199 | fs/locks.c | fl->fl_end - fl->fl_start + 1; |
fl | 201 | fs/locks.c | flock.l_type = fl->fl_type; |
fl | 263 | fs/locks.c | struct file_lock *fl; |
fl | 271 | fs/locks.c | while ((fl = *before) != NULL) { |
fl | 272 | fs/locks.c | if (((fl->fl_flags == F_POSIX) && (fl->fl_owner == task)) || |
fl | 273 | fs/locks.c | ((fl->fl_flags == F_FLOCK) && (fl->fl_file == filp) && |
fl | 277 | fs/locks.c | before = &fl->fl_next; |
fl | 286 | fs/locks.c | static int posix_make_lock(struct file *filp, struct file_lock *fl, |
fl | 298 | fs/locks.c | fl->fl_type = l->l_type; |
fl | 301 | fs/locks.c | fl->fl_type = F_RDLCK; |
fl | 304 | fs/locks.c | fl->fl_type = F_WRLCK; |
fl | 326 | fs/locks.c | fl->fl_start = start; /* we record the absolute position */ |
fl | 327 | fs/locks.c | if ((l->l_len == 0) || ((fl->fl_end = start + l->l_len - 1) < 0)) |
fl | 328 | fs/locks.c | fl->fl_end = OFFSET_MAX; |
fl | 330 | fs/locks.c | fl->fl_flags = F_POSIX; |
fl | 331 | fs/locks.c | fl->fl_file = filp; |
fl | 332 | fs/locks.c | fl->fl_owner = current; |
fl | 333 | fs/locks.c | fl->fl_wait = NULL; /* just for cleanliness */ |
fl | 341 | fs/locks.c | static int flock_make_lock(struct file *filp, struct file_lock *fl, |
fl | 349 | fs/locks.c | fl->fl_type = F_RDLCK; |
fl | 352 | fs/locks.c | fl->fl_type = F_WRLCK; |
fl | 355 | fs/locks.c | fl->fl_type = F_UNLCK; |
fl | 361 | fs/locks.c | fl->fl_flags = F_FLOCK; |
fl | 362 | fs/locks.c | fl->fl_start = 0; |
fl | 363 | fs/locks.c | fl->fl_end = OFFSET_MAX; |
fl | 364 | fs/locks.c | fl->fl_file = filp; |
fl | 365 | fs/locks.c | fl->fl_owner = current; |
fl | 366 | fs/locks.c | fl->fl_wait = NULL; /* just for cleanliness */ |
fl | 446 | fs/locks.c | struct file_lock *fl; |
fl | 448 | fs/locks.c | for (fl = file_lock_table; fl != NULL; fl = fl->fl_nextlink) { |
fl | 449 | fs/locks.c | if (fl->fl_owner == NULL) |
fl | 451 | fs/locks.c | if (fl->fl_owner != my_task) |
fl | 453 | fs/locks.c | if (fl->fl_wait == NULL) |
fl | 455 | fs/locks.c | dlock_wait = fl->fl_wait; |
fl | 464 | fs/locks.c | } while (dlock_wait != fl->fl_wait); |
fl | 476 | fs/locks.c | struct file_lock *fl; |
fl | 485 | fs/locks.c | while ((fl = *before) && (fl->fl_flags == F_FLOCK)) { |
fl | 486 | fs/locks.c | if (caller->fl_file == fl->fl_file) { |
fl | 487 | fs/locks.c | if (caller->fl_type == fl->fl_type) |
fl | 492 | fs/locks.c | before = &fl->fl_next; |
fl | 504 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 505 | fs/locks.c | if (!flock_locks_conflict(new_fl, fl)) |
fl | 518 | fs/locks.c | locks_insert_block(&fl->fl_block, new_fl); |
fl | 529 | fs/locks.c | locks_delete_block(&fl->fl_block, new_fl); |
fl | 558 | fs/locks.c | struct file_lock *fl; |
fl | 567 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 568 | fs/locks.c | if (!posix_locks_conflict(caller, fl)) |
fl | 573 | fs/locks.c | if (fl->fl_flags == F_POSIX) |
fl | 574 | fs/locks.c | if (posix_locks_deadlock(caller->fl_owner, fl->fl_owner)) |
fl | 576 | fs/locks.c | interruptible_sleep_on(&fl->fl_wait); |
fl | 592 | fs/locks.c | while ((fl = *before) && ((fl->fl_flags == F_FLOCK) || |
fl | 593 | fs/locks.c | (caller->fl_owner != fl->fl_owner))) { |
fl | 594 | fs/locks.c | before = &fl->fl_next; |
fl | 600 | fs/locks.c | while ((fl = *before) && (caller->fl_owner == fl->fl_owner)) { |
fl | 603 | fs/locks.c | if (caller->fl_type == fl->fl_type) { |
fl | 604 | fs/locks.c | if (fl->fl_end < caller->fl_start - 1) |
fl | 609 | fs/locks.c | if (fl->fl_start > caller->fl_end + 1) |
fl | 617 | fs/locks.c | if (fl->fl_start > caller->fl_start) |
fl | 618 | fs/locks.c | fl->fl_start = caller->fl_start; |
fl | 620 | fs/locks.c | caller->fl_start = fl->fl_start; |
fl | 621 | fs/locks.c | if (fl->fl_end < caller->fl_end) |
fl | 622 | fs/locks.c | fl->fl_end = caller->fl_end; |
fl | 624 | fs/locks.c | caller->fl_end = fl->fl_end; |
fl | 629 | fs/locks.c | caller = fl; |
fl | 635 | fs/locks.c | if (fl->fl_end < caller->fl_start) |
fl | 637 | fs/locks.c | if (fl->fl_start > caller->fl_end) |
fl | 641 | fs/locks.c | if (fl->fl_start < caller->fl_start) |
fl | 642 | fs/locks.c | left = fl; |
fl | 646 | fs/locks.c | if (fl->fl_end > caller->fl_end) { |
fl | 647 | fs/locks.c | right = fl; |
fl | 650 | fs/locks.c | if (fl->fl_start >= caller->fl_start) { |
fl | 662 | fs/locks.c | wake_up(&fl->fl_wait); |
fl | 663 | fs/locks.c | fl->fl_start = caller->fl_start; |
fl | 664 | fs/locks.c | fl->fl_end = caller->fl_end; |
fl | 665 | fs/locks.c | fl->fl_type = caller->fl_type; |
fl | 666 | fs/locks.c | caller = fl; |
fl | 720 | fs/locks.c | static struct file_lock *locks_alloc_lock(struct file_lock *fl) |
fl | 733 | fs/locks.c | tmp->fl_flags = fl->fl_flags; |
fl | 734 | fs/locks.c | tmp->fl_owner = fl->fl_owner; |
fl | 735 | fs/locks.c | tmp->fl_file = fl->fl_file; |
fl | 737 | fs/locks.c | tmp->fl_type = fl->fl_type; |
fl | 738 | fs/locks.c | tmp->fl_start = fl->fl_start; |
fl | 739 | fs/locks.c | tmp->fl_end = fl->fl_end; |
fl | 748 | fs/locks.c | static void locks_insert_lock(struct file_lock **pos, struct file_lock *fl) |
fl | 750 | fs/locks.c | fl->fl_nextlink = file_lock_table; |
fl | 751 | fs/locks.c | fl->fl_prevlink = NULL; |
fl | 753 | fs/locks.c | file_lock_table->fl_prevlink = fl; |
fl | 754 | fs/locks.c | file_lock_table = fl; |
fl | 755 | fs/locks.c | fl->fl_next = *pos; /* insert into file's list */ |
fl | 756 | fs/locks.c | *pos = fl; |
fl | 771 | fs/locks.c | struct file_lock *fl; |
fl | 774 | fs/locks.c | fl = *fl_p; |
fl | 777 | fs/locks.c | if (fl->fl_nextlink != NULL) |
fl | 778 | fs/locks.c | fl->fl_nextlink->fl_prevlink = fl->fl_prevlink; |
fl | 780 | fs/locks.c | if (fl->fl_prevlink != NULL) |
fl | 781 | fs/locks.c | fl->fl_prevlink->fl_nextlink = fl->fl_nextlink; |
fl | 783 | fs/locks.c | file_lock_table = fl->fl_nextlink; |
fl | 786 | fs/locks.c | while ((bfl = fl->fl_block) != NULL) { |
fl | 787 | fs/locks.c | fl->fl_block = bfl->fl_block; |
fl | 794 | fs/locks.c | wake_up(&fl->fl_wait); |
fl | 795 | fs/locks.c | kfree(fl); |