Lines Matching refs:lock

763 	 * Delete any outstanding lock records. We'll lose them when the file
1485 /* BB can we lock the filestruct while this is going on? */
1493 struct cifsLockInfo *lock =
1495 if (!lock)
1496 return lock;
1497 lock->offset = offset;
1498 lock->length = length;
1499 lock->type = type;
1500 lock->pid = current->tgid;
1501 lock->flags = flags;
1502 INIT_LIST_HEAD(&lock->blist);
1503 init_waitqueue_head(&lock->block_q);
1504 return lock;
1508 cifs_del_lock_waiters(struct cifsLockInfo *lock)
1511 list_for_each_entry_safe(li, tmp, &lock->blist, blist) {
1538 /* shared lock prevents write op through the same fid */
1579 * Check if there is another lock that prevents us to set the lock (mandatory
1580 * style). If such a lock exists, update the flock structure with its
1618 cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock)
1622 list_add_tail(&lock->llist, &cfile->llist->locks);
1627 * Set the byte-range lock (mandatory style). Returns:
1628 * 1) 0, if we set the lock and don't need to request to the server;
1630 * 3) -EACCES, if there is a lock that prevents us and wait is false.
1633 cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
1645 exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length,
1646 lock->type, lock->flags, &conf_lock,
1649 list_add_tail(&lock->llist, &cfile->llist->locks);
1659 list_add_tail(&lock->blist, &conf_lock->blist);
1661 rc = wait_event_interruptible(lock->block_q,
1662 (lock->blist.prev == &lock->blist) &&
1663 (lock->blist.next == &lock->blist));
1667 list_del_init(&lock->blist);
1676 * Check if there is another lock that prevents us to set the lock (posix
1677 * style). If such a lock exists, update the flock structure with its
1705 * Set the byte-range lock (posix style). Returns:
1706 * 1) <0, if the error occurs while setting the lock;
1707 * 2) 0, if we set the lock and don't need to request to the server;
1948 cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
1956 cifs_dbg(FYI, "Blocking lock\n");
1966 cifs_dbg(FYI, "Unknown lock flags 0x%x\n",
1973 *lock = 1;
1978 /* Check if unlock includes more than one lock range */
1982 *lock = 1;
1986 *lock = 1;
1990 *lock = 1;
1992 cifs_dbg(FYI, "Unknown type of lock\n");
2030 /* BB we could chain these into one lock request BB */
2038 cifs_dbg(VFS, "Error unlocking previously locked range %d during test of lock\n",
2058 cifs_dbg(VFS, "Error unlocking previously locked range %d during test of lock\n",
2140 * a lock from the file's list.
2153 * We need to save a lock here to let us add it again to
2202 bool wait_flag, bool posix_lck, int lock, int unlock,
2235 if (lock) {
2236 struct cifsLockInfo *lock;
2238 lock = cifs_lock_init(flock->fl_start, length, type,
2240 if (!lock)
2243 rc = cifs_lock_add_if(cfile, lock, wait_flag);
2245 kfree(lock);
2253 * if we set a byte-range lock on a file - break it explicitly
2254 * before sending the lock to the server to be sure the next
2269 kfree(lock);
2273 cifs_lock_add(cfile, lock);
2283 * remove the lock on file close
2298 int lock = 0, unlock = 0;
2317 cifs_read_flock(fl, &type, &lock, &unlock, &wait_flag,
2326 if (!lock && !unlock) {
2328 * if no lock or unlock then nothing to do since we do not
2336 rc = cifs_setlk(file, fl, type, wait_flag, posix_lck, lock, unlock,
2347 int lock = 0, unlock = 0;
2366 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
2385 if (!lock && !unlock) {
2387 * if no lock or unlock then nothing to do since we do not
2394 rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock,
2436 /* lock it so it will not be closed on us */
2761 * We need to hold the sem to be sure nobody modifies lock list
2916 * We need to hold the sem to be sure nobody modifies lock list
3170 * but we could add call to grab a byte range lock to prevent others