Lines Matching refs:cfile

41 static int cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush);
54 struct cifsFileInfo *open_file = req->cfile; in cifs_prepare_write()
120 if (wdata->req->cfile->invalidHandle) in cifs_issue_write()
163 server->ops->negotiate_rsize(tlink_tcon(req->cfile->tlink), in cifs_prepare_read()
212 if (req->cfile->invalidHandle) { in cifs_issue_read()
214 rc = cifs_reopen_file(req->cfile, true); in cifs_issue_read()
242 ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_ANY, &req->cfile); in cifs_begin_writeback()
267 req->cfile = cifsFileInfo_get(open_file); in cifs_init_request()
268 req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses); in cifs_init_request()
270 req->pid = req->cfile->pid; in cifs_init_request()
298 if (req->cfile) in cifs_free_request()
299 cifsFileInfo_put(req->cfile); in cifs_free_request()
656 struct cifsFileInfo *cfile; in cifs_new_fileinfo() local
661 cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); in cifs_new_fileinfo()
662 if (cfile == NULL) in cifs_new_fileinfo()
663 return cfile; in cifs_new_fileinfo()
667 kfree(cfile); in cifs_new_fileinfo()
672 cfile->symlink_target = kstrdup(symlink_target, GFP_KERNEL); in cifs_new_fileinfo()
673 if (!cfile->symlink_target) { in cifs_new_fileinfo()
675 kfree(cfile); in cifs_new_fileinfo()
681 fdlocks->cfile = cfile; in cifs_new_fileinfo()
682 cfile->llist = fdlocks; in cifs_new_fileinfo()
684 cfile->count = 1; in cifs_new_fileinfo()
685 cfile->pid = current->tgid; in cifs_new_fileinfo()
686 cfile->uid = current_fsuid(); in cifs_new_fileinfo()
687 cfile->dentry = dget(dentry); in cifs_new_fileinfo()
688 cfile->f_flags = file->f_flags; in cifs_new_fileinfo()
689 cfile->invalidHandle = false; in cifs_new_fileinfo()
690 cfile->deferred_close_scheduled = false; in cifs_new_fileinfo()
691 cfile->tlink = cifs_get_tlink(tlink); in cifs_new_fileinfo()
692 INIT_WORK(&cfile->oplock_break, cifs_oplock_break); in cifs_new_fileinfo()
693 INIT_WORK(&cfile->put, cifsFileInfo_put_work); in cifs_new_fileinfo()
694 INIT_WORK(&cfile->serverclose, serverclose_work); in cifs_new_fileinfo()
695 INIT_DELAYED_WORK(&cfile->deferred, smb2_deferred_work_close); in cifs_new_fileinfo()
696 mutex_init(&cfile->fh_mutex); in cifs_new_fileinfo()
697 spin_lock_init(&cfile->file_info_lock); in cifs_new_fileinfo()
720 server->ops->set_fid(cfile, fid, oplock); in cifs_new_fileinfo()
722 list_add(&cfile->tlist, &tcon->openFileList); in cifs_new_fileinfo()
728 list_add(&cfile->flist, &cinode->openFileList); in cifs_new_fileinfo()
730 list_add_tail(&cfile->flist, &cinode->openFileList); in cifs_new_fileinfo()
737 file->private_data = cfile; in cifs_new_fileinfo()
738 return cfile; in cifs_new_fileinfo()
950 struct cifsFileInfo *cfile = NULL; in cifs_open() local
993 rc = cifs_get_readable_path(tcon, full_path, &cfile); in cifs_open()
995 if (file->f_flags == cfile->f_flags) { in cifs_open()
996 file->private_data = cfile; in cifs_open()
998 cifs_del_deferred_close(cfile); in cifs_open()
1002 _cifsFileInfo_put(cfile, true, false); in cifs_open()
1055 cfile = cifs_new_fileinfo(&fid, file, tlink, oplock, data.symlink_target); in cifs_open()
1056 if (cfile == NULL) { in cifs_open()
1080 cfile->pid); in cifs_open()
1102 static int cifs_push_posix_locks(struct cifsFileInfo *cfile);
1110 cifs_relock_file(struct cifsFileInfo *cfile) in cifs_relock_file() argument
1112 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_relock_file()
1113 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_relock_file()
1116 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); in cifs_relock_file()
1130 rc = cifs_push_posix_locks(cfile); in cifs_relock_file()
1133 rc = tcon->ses->server->ops->push_mand_locks(cfile); in cifs_relock_file()
1140 cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) in cifs_reopen_file() argument
1159 mutex_lock(&cfile->fh_mutex); in cifs_reopen_file()
1160 if (!cfile->invalidHandle) { in cifs_reopen_file()
1161 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1166 inode = d_inode(cfile->dentry); in cifs_reopen_file()
1168 tcon = tlink_tcon(cfile->tlink); in cifs_reopen_file()
1178 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_reopen_file()
1180 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1187 inode, cfile->f_flags, full_path); in cifs_reopen_file()
1202 unsigned int oflags = cfile->f_flags & in cifs_reopen_file()
1207 oflags, &oplock, &cfile->fid.netfid, xid); in cifs_reopen_file()
1221 if (cifs_fscache_enabled(inode) && (cfile->f_flags & O_ACCMODE) == O_WRONLY) in cifs_reopen_file()
1224 desired_access = cifs_convert_flags(cfile->f_flags, rdwr_for_fscache); in cifs_reopen_file()
1227 if (cfile->f_flags & O_SYNC) in cifs_reopen_file()
1230 if (cfile->f_flags & O_DIRECT) in cifs_reopen_file()
1234 server->ops->get_lease_key(inode, &cfile->fid); in cifs_reopen_file()
1244 .fid = &cfile->fid, in cifs_reopen_file()
1263 desired_access = cifs_convert_flags(cfile->f_flags, 0); in cifs_reopen_file()
1269 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1281 cfile->invalidHandle = false; in cifs_reopen_file()
1282 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1317 server->ops->set_fid(cfile, &cfile->fid, oplock); in cifs_reopen_file()
1319 cifs_relock_file(cfile); in cifs_reopen_file()
1329 struct cifsFileInfo *cfile = container_of(work, in smb2_deferred_work_close() local
1332 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in smb2_deferred_work_close()
1333 cifs_del_deferred_close(cfile); in smb2_deferred_work_close()
1334 cfile->deferred_close_scheduled = false; in smb2_deferred_work_close()
1335 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in smb2_deferred_work_close()
1336 _cifsFileInfo_put(cfile, true, false); in smb2_deferred_work_close()
1354 struct cifsFileInfo *cfile; in cifs_close() local
1362 cfile = file->private_data; in cifs_close()
1365 if ((cfile->status_file_deleted == false) && in cifs_close()
1372 cifs_add_deferred_close(cfile, dclose); in cifs_close()
1373 if (cfile->deferred_close_scheduled && in cifs_close()
1374 delayed_work_pending(&cfile->deferred)) { in cifs_close()
1380 &cfile->deferred, cifs_sb->ctx->closetimeo)) in cifs_close()
1381 cifsFileInfo_get(cfile); in cifs_close()
1385 &cfile->deferred, cifs_sb->ctx->closetimeo); in cifs_close()
1386 cfile->deferred_close_scheduled = true; in cifs_close()
1391 _cifsFileInfo_put(cfile, true, false); in cifs_close()
1393 _cifsFileInfo_put(cfile, true, false); in cifs_close()
1437 struct cifsFileInfo *cfile = file->private_data; in cifs_closedir() local
1444 if (cfile == NULL) in cifs_closedir()
1448 tcon = tlink_tcon(cfile->tlink); in cifs_closedir()
1452 spin_lock(&cfile->file_info_lock); in cifs_closedir()
1453 if (server->ops->dir_needs_close(cfile)) { in cifs_closedir()
1454 cfile->invalidHandle = true; in cifs_closedir()
1455 spin_unlock(&cfile->file_info_lock); in cifs_closedir()
1457 rc = server->ops->close_dir(xid, tcon, &cfile->fid); in cifs_closedir()
1464 spin_unlock(&cfile->file_info_lock); in cifs_closedir()
1466 buf = cfile->srch_inf.ntwrk_buf_start; in cifs_closedir()
1469 cfile->srch_inf.ntwrk_buf_start = NULL; in cifs_closedir()
1470 if (cfile->srch_inf.smallBuf) in cifs_closedir()
1476 cifs_put_tlink(cfile->tlink); in cifs_closedir()
1519 struct cifsFileInfo *cfile, in cifs_find_fid_lock_conflict() argument
1523 struct cifsFileInfo *cur_cfile = fdlocks->cfile; in cifs_find_fid_lock_conflict()
1524 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_find_fid_lock_conflict()
1531 server->ops->compare_fids(cfile, cur_cfile)) { in cifs_find_fid_lock_conflict()
1538 ((server->ops->compare_fids(cfile, cur_cfile) && in cifs_find_fid_lock_conflict()
1543 server->ops->compare_fids(cfile, cur_cfile)) in cifs_find_fid_lock_conflict()
1553 cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset, __u64 length, in cifs_find_lock_conflict() argument
1559 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_find_lock_conflict()
1563 flags, cfile, conf_lock, in cifs_find_lock_conflict()
1580 cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length, in cifs_lock_test() argument
1585 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_test()
1586 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_lock_test()
1591 exist = cifs_find_lock_conflict(cfile, offset, length, type, in cifs_lock_test()
1612 cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) in cifs_lock_add() argument
1614 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_add()
1616 list_add_tail(&lock->llist, &cfile->llist->locks); in cifs_lock_add()
1627 cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, in cifs_lock_add_if() argument
1631 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_add_if()
1639 exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length, in cifs_lock_add_if()
1643 list_add_tail(&lock->llist, &cfile->llist->locks); in cifs_lock_add_if()
1726 cifs_push_mandatory_locks(struct cifsFileInfo *cfile) in cifs_push_mandatory_locks() argument
1741 tcon = tlink_tcon(cfile->tlink); in cifs_push_mandatory_locks()
1768 list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { in cifs_push_mandatory_locks()
1778 cfile->fid.netfid, in cifs_push_mandatory_locks()
1790 stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, in cifs_push_mandatory_locks()
1820 cifs_push_posix_locks(struct cifsFileInfo *cfile) in cifs_push_posix_locks() argument
1822 struct inode *inode = d_inode(cfile->dentry); in cifs_push_posix_locks()
1823 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_push_posix_locks()
1879 lck->netfid = cfile->fid.netfid; in cifs_push_posix_locks()
1911 cifs_push_locks(struct cifsFileInfo *cfile) in cifs_push_locks() argument
1913 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_push_locks()
1914 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_push_locks()
1917 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); in cifs_push_locks()
1931 rc = cifs_push_posix_locks(cfile); in cifs_push_locks()
1934 rc = tcon->ses->server->ops->push_mand_locks(cfile); in cifs_push_locks()
1995 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_getlk() local
1996 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_getlk()
1999 __u16 netfid = cfile->fid.netfid; in cifs_getlk()
2020 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
2025 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
2028 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
2044 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
2048 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
2081 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
2092 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_unlock_range()
2093 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_unlock_range()
2120 list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { in cifs_unlock_range()
2152 cfile->fid.netfid, in cifs_unlock_range()
2161 &cfile->llist->locks); in cifs_unlock_range()
2175 stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, in cifs_unlock_range()
2179 &cfile->llist->locks); in cifs_unlock_range()
2199 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_setlk() local
2200 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_setlk()
2202 struct inode *inode = d_inode(cfile->dentry); in cifs_setlk()
2220 rc = CIFSSMBPosixLock(xid, tcon, cfile->fid.netfid, in cifs_setlk()
2235 rc = cifs_lock_add_if(cfile, lock, wait_flag); in cifs_setlk()
2258 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
2265 cifs_lock_add(cfile, lock); in cifs_setlk()
2267 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
2295 struct cifsFileInfo *cfile; in cifs_flock() local
2306 cfile = (struct cifsFileInfo *)file->private_data; in cifs_flock()
2307 tcon = tlink_tcon(cfile->tlink); in cifs_flock()
2344 struct cifsFileInfo *cfile; in cifs_lock() local
2355 cfile = (struct cifsFileInfo *)file->private_data; in cifs_lock()
2356 tcon = tlink_tcon(cfile->tlink); in cifs_lock()
2361 set_bit(CIFS_INO_CLOSE_ON_LOCK, &CIFS_I(d_inode(cfile->dentry))->flags); in cifs_lock()
2541 struct cifsFileInfo *cfile; in find_writable_file() local
2544 rc = cifs_get_writable_file(cifs_inode, flags, &cfile); in find_writable_file()
2548 return cfile; in find_writable_file()
2556 struct cifsFileInfo *cfile; in cifs_get_writable_path() local
2562 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_get_writable_path()
2564 const char *full_path = build_path_from_dentry(cfile->dentry, page); in cifs_get_writable_path()
2573 cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_get_writable_path()
2588 struct cifsFileInfo *cfile; in cifs_get_readable_path() local
2594 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_get_readable_path()
2596 const char *full_path = build_path_from_dentry(cfile->dentry, page); in cifs_get_readable_path()
2605 cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_get_readable_path()
2747 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_writev() local
2750 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_writev()
2769 (cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(from), in cifs_writev()
2792 struct cifsFileInfo *cfile = (struct cifsFileInfo *) in cifs_strict_writev() local
2794 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_strict_writev()
2893 struct cifsFileInfo *cfile = (struct cifsFileInfo *) in cifs_strict_readv() local
2895 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_strict_readv()
2926 cfile, iocb->ki_pos, iov_iter_count(to), in cifs_strict_readv()
2939 cfile, iocb->ki_pos, iov_iter_count(to), in cifs_strict_readv()
3047 struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, in cifs_oplock_break() local
3049 struct inode *inode = d_inode(cfile->dentry); in cifs_oplock_break()
3069 server->ops->downgrade_oplock(server, cinode, cfile->oplock_level, in cifs_oplock_break()
3070 cfile->oplock_epoch, &purge_cache); in cifs_oplock_break()
3095 rc = cifs_push_locks(cfile); in cifs_oplock_break()
3109 persistent_fid = cfile->fid.persistent_fid; in cifs_oplock_break()
3110 volatile_fid = cfile->fid.volatile_fid; in cifs_oplock_break()
3111 net_fid = cfile->fid.netfid; in cifs_oplock_break()
3112 oplock_break_cancelled = cfile->oplock_break_cancelled; in cifs_oplock_break()
3114 _cifsFileInfo_put(cfile, false /* do not wait for ourself */, false); in cifs_oplock_break()
3137 struct cifsFileInfo *cfile = swap_file->private_data; in cifs_swap_activate() local
3168 if (cfile) in cifs_swap_activate()
3169 cfile->swapfile = true; in cifs_swap_activate()
3182 struct cifsFileInfo *cfile = file->private_data; in cifs_swap_deactivate() local
3188 if (cfile) in cifs_swap_deactivate()
3189 cfile->swapfile = false; in cifs_swap_deactivate()