Lines Matching refs:cfile
471 struct cifsFileInfo *cfile; in cifs_new_fileinfo() local
476 cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); in cifs_new_fileinfo()
477 if (cfile == NULL) in cifs_new_fileinfo()
478 return cfile; in cifs_new_fileinfo()
482 kfree(cfile); in cifs_new_fileinfo()
487 cfile->symlink_target = kstrdup(symlink_target, GFP_KERNEL); in cifs_new_fileinfo()
488 if (!cfile->symlink_target) { in cifs_new_fileinfo()
490 kfree(cfile); in cifs_new_fileinfo()
496 fdlocks->cfile = cfile; in cifs_new_fileinfo()
497 cfile->llist = fdlocks; in cifs_new_fileinfo()
499 cfile->count = 1; in cifs_new_fileinfo()
500 cfile->pid = current->tgid; in cifs_new_fileinfo()
501 cfile->uid = current_fsuid(); in cifs_new_fileinfo()
502 cfile->dentry = dget(dentry); in cifs_new_fileinfo()
503 cfile->f_flags = file->f_flags; in cifs_new_fileinfo()
504 cfile->invalidHandle = false; in cifs_new_fileinfo()
505 cfile->deferred_close_scheduled = false; in cifs_new_fileinfo()
506 cfile->tlink = cifs_get_tlink(tlink); in cifs_new_fileinfo()
507 INIT_WORK(&cfile->oplock_break, cifs_oplock_break); in cifs_new_fileinfo()
508 INIT_WORK(&cfile->put, cifsFileInfo_put_work); in cifs_new_fileinfo()
509 INIT_WORK(&cfile->serverclose, serverclose_work); in cifs_new_fileinfo()
510 INIT_DELAYED_WORK(&cfile->deferred, smb2_deferred_work_close); in cifs_new_fileinfo()
511 mutex_init(&cfile->fh_mutex); in cifs_new_fileinfo()
512 spin_lock_init(&cfile->file_info_lock); in cifs_new_fileinfo()
535 server->ops->set_fid(cfile, fid, oplock); in cifs_new_fileinfo()
537 list_add(&cfile->tlist, &tcon->openFileList); in cifs_new_fileinfo()
543 list_add(&cfile->flist, &cinode->openFileList); in cifs_new_fileinfo()
545 list_add_tail(&cfile->flist, &cinode->openFileList); in cifs_new_fileinfo()
552 file->private_data = cfile; in cifs_new_fileinfo()
553 return cfile; in cifs_new_fileinfo()
765 struct cifsFileInfo *cfile = NULL; in cifs_open() local
808 rc = cifs_get_readable_path(tcon, full_path, &cfile); in cifs_open()
810 if (file->f_flags == cfile->f_flags) { in cifs_open()
811 file->private_data = cfile; in cifs_open()
813 cifs_del_deferred_close(cfile); in cifs_open()
817 _cifsFileInfo_put(cfile, true, false); in cifs_open()
870 cfile = cifs_new_fileinfo(&fid, file, tlink, oplock, data.symlink_target); in cifs_open()
871 if (cfile == NULL) { in cifs_open()
895 cfile->pid); in cifs_open()
917 static int cifs_push_posix_locks(struct cifsFileInfo *cfile);
925 cifs_relock_file(struct cifsFileInfo *cfile) in cifs_relock_file() argument
927 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_relock_file()
928 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_relock_file()
931 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); in cifs_relock_file()
945 rc = cifs_push_posix_locks(cfile); in cifs_relock_file()
948 rc = tcon->ses->server->ops->push_mand_locks(cfile); in cifs_relock_file()
955 cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) in cifs_reopen_file() argument
974 mutex_lock(&cfile->fh_mutex); in cifs_reopen_file()
975 if (!cfile->invalidHandle) { in cifs_reopen_file()
976 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
981 inode = d_inode(cfile->dentry); in cifs_reopen_file()
983 tcon = tlink_tcon(cfile->tlink); in cifs_reopen_file()
993 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_reopen_file()
995 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1002 inode, cfile->f_flags, full_path); in cifs_reopen_file()
1017 unsigned int oflags = cfile->f_flags & in cifs_reopen_file()
1022 oflags, &oplock, &cfile->fid.netfid, xid); in cifs_reopen_file()
1036 if (cifs_fscache_enabled(inode) && (cfile->f_flags & O_ACCMODE) == O_WRONLY) in cifs_reopen_file()
1039 desired_access = cifs_convert_flags(cfile->f_flags, rdwr_for_fscache); in cifs_reopen_file()
1042 if (cfile->f_flags & O_SYNC) in cifs_reopen_file()
1045 if (cfile->f_flags & O_DIRECT) in cifs_reopen_file()
1049 server->ops->get_lease_key(inode, &cfile->fid); in cifs_reopen_file()
1059 .fid = &cfile->fid, in cifs_reopen_file()
1078 desired_access = cifs_convert_flags(cfile->f_flags, 0); in cifs_reopen_file()
1084 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1096 cfile->invalidHandle = false; in cifs_reopen_file()
1097 mutex_unlock(&cfile->fh_mutex); in cifs_reopen_file()
1132 server->ops->set_fid(cfile, &cfile->fid, oplock); in cifs_reopen_file()
1134 cifs_relock_file(cfile); in cifs_reopen_file()
1144 struct cifsFileInfo *cfile = container_of(work, in smb2_deferred_work_close() local
1147 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in smb2_deferred_work_close()
1148 cifs_del_deferred_close(cfile); in smb2_deferred_work_close()
1149 cfile->deferred_close_scheduled = false; in smb2_deferred_work_close()
1150 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in smb2_deferred_work_close()
1151 _cifsFileInfo_put(cfile, true, false); in smb2_deferred_work_close()
1169 struct cifsFileInfo *cfile; in cifs_close() local
1177 cfile = file->private_data; in cifs_close()
1180 if ((cfile->status_file_deleted == false) && in cifs_close()
1187 cifs_add_deferred_close(cfile, dclose); in cifs_close()
1188 if (cfile->deferred_close_scheduled && in cifs_close()
1189 delayed_work_pending(&cfile->deferred)) { in cifs_close()
1195 &cfile->deferred, cifs_sb->ctx->closetimeo)) in cifs_close()
1196 cifsFileInfo_get(cfile); in cifs_close()
1200 &cfile->deferred, cifs_sb->ctx->closetimeo); in cifs_close()
1201 cfile->deferred_close_scheduled = true; in cifs_close()
1206 _cifsFileInfo_put(cfile, true, false); in cifs_close()
1208 _cifsFileInfo_put(cfile, true, false); in cifs_close()
1253 struct cifsFileInfo *cfile = file->private_data; in cifs_closedir() local
1260 if (cfile == NULL) in cifs_closedir()
1264 tcon = tlink_tcon(cfile->tlink); in cifs_closedir()
1268 spin_lock(&cfile->file_info_lock); in cifs_closedir()
1269 if (server->ops->dir_needs_close(cfile)) { in cifs_closedir()
1270 cfile->invalidHandle = true; in cifs_closedir()
1271 spin_unlock(&cfile->file_info_lock); in cifs_closedir()
1273 rc = server->ops->close_dir(xid, tcon, &cfile->fid); in cifs_closedir()
1280 spin_unlock(&cfile->file_info_lock); in cifs_closedir()
1282 buf = cfile->srch_inf.ntwrk_buf_start; in cifs_closedir()
1285 cfile->srch_inf.ntwrk_buf_start = NULL; in cifs_closedir()
1286 if (cfile->srch_inf.smallBuf) in cifs_closedir()
1292 cifs_put_tlink(cfile->tlink); in cifs_closedir()
1335 struct cifsFileInfo *cfile, in cifs_find_fid_lock_conflict() argument
1339 struct cifsFileInfo *cur_cfile = fdlocks->cfile; in cifs_find_fid_lock_conflict()
1340 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_find_fid_lock_conflict()
1347 server->ops->compare_fids(cfile, cur_cfile)) { in cifs_find_fid_lock_conflict()
1354 ((server->ops->compare_fids(cfile, cur_cfile) && in cifs_find_fid_lock_conflict()
1359 server->ops->compare_fids(cfile, cur_cfile)) in cifs_find_fid_lock_conflict()
1369 cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset, __u64 length, in cifs_find_lock_conflict() argument
1375 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_find_lock_conflict()
1379 flags, cfile, conf_lock, in cifs_find_lock_conflict()
1396 cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length, in cifs_lock_test() argument
1401 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_test()
1402 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_lock_test()
1407 exist = cifs_find_lock_conflict(cfile, offset, length, type, in cifs_lock_test()
1428 cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) in cifs_lock_add() argument
1430 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_add()
1432 list_add_tail(&lock->llist, &cfile->llist->locks); in cifs_lock_add()
1443 cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, in cifs_lock_add_if() argument
1447 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_lock_add_if()
1455 exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length, in cifs_lock_add_if()
1459 list_add_tail(&lock->llist, &cfile->llist->locks); in cifs_lock_add_if()
1542 cifs_push_mandatory_locks(struct cifsFileInfo *cfile) in cifs_push_mandatory_locks() argument
1557 tcon = tlink_tcon(cfile->tlink); in cifs_push_mandatory_locks()
1584 list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { in cifs_push_mandatory_locks()
1594 cfile->fid.netfid, in cifs_push_mandatory_locks()
1606 stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, in cifs_push_mandatory_locks()
1636 cifs_push_posix_locks(struct cifsFileInfo *cfile) in cifs_push_posix_locks() argument
1638 struct inode *inode = d_inode(cfile->dentry); in cifs_push_posix_locks()
1639 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_push_posix_locks()
1693 lck->netfid = cfile->fid.netfid; in cifs_push_posix_locks()
1725 cifs_push_locks(struct cifsFileInfo *cfile) in cifs_push_locks() argument
1727 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_push_locks()
1728 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_push_locks()
1731 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); in cifs_push_locks()
1745 rc = cifs_push_posix_locks(cfile); in cifs_push_locks()
1748 rc = tcon->ses->server->ops->push_mand_locks(cfile); in cifs_push_locks()
1808 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_getlk() local
1809 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_getlk()
1812 __u16 netfid = cfile->fid.netfid; in cifs_getlk()
1833 rc = cifs_lock_test(cfile, flock->fl_start, length, type, flock); in cifs_getlk()
1838 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, in cifs_getlk()
1841 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1857 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1861 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_getlk()
1894 cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, in cifs_unlock_range() argument
1905 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_unlock_range()
1906 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_unlock_range()
1935 list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { in cifs_unlock_range()
1967 cfile->fid.netfid, in cifs_unlock_range()
1976 &cfile->llist->locks); in cifs_unlock_range()
1990 stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, in cifs_unlock_range()
1994 &cfile->llist->locks); in cifs_unlock_range()
2014 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_setlk() local
2015 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_setlk()
2017 struct inode *inode = d_inode(cfile->dentry); in cifs_setlk()
2035 rc = CIFSSMBPosixLock(xid, tcon, cfile->fid.netfid, in cifs_setlk()
2050 rc = cifs_lock_add_if(cfile, lock, wait_flag); in cifs_setlk()
2073 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, in cifs_setlk()
2080 cifs_lock_add(cfile, lock); in cifs_setlk()
2082 rc = server->ops->mand_unlock_range(cfile, flock, xid); in cifs_setlk()
2110 struct cifsFileInfo *cfile; in cifs_flock() local
2121 cfile = (struct cifsFileInfo *)file->private_data; in cifs_flock()
2122 tcon = tlink_tcon(cfile->tlink); in cifs_flock()
2159 struct cifsFileInfo *cfile; in cifs_lock() local
2169 cfile = (struct cifsFileInfo *)file->private_data; in cifs_lock()
2170 tcon = tlink_tcon(cfile->tlink); in cifs_lock()
2175 set_bit(CIFS_INO_CLOSE_ON_LOCK, &CIFS_I(d_inode(cfile->dentry))->flags); in cifs_lock()
2432 struct cifsFileInfo *cfile; in find_writable_file() local
2435 rc = cifs_get_writable_file(cifs_inode, flags, &cfile); in find_writable_file()
2439 return cfile; in find_writable_file()
2447 struct cifsFileInfo *cfile; in cifs_get_writable_path() local
2453 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_get_writable_path()
2455 const char *full_path = build_path_from_dentry(cfile->dentry, page); in cifs_get_writable_path()
2464 cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_get_writable_path()
2479 struct cifsFileInfo *cfile; in cifs_get_readable_path() local
2485 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_get_readable_path()
2487 const char *full_path = build_path_from_dentry(cfile->dentry, page); in cifs_get_readable_path()
2496 cinode = CIFS_I(d_inode(cfile->dentry)); in cifs_get_readable_path()
2520 if (wdata->cfile) in cifs_writedata_release()
2521 cifsFileInfo_put(wdata->cfile); in cifs_writedata_release()
2534 struct inode *inode = d_inode(wdata->cfile->dentry); in cifs_writev_requeue()
2539 server = tlink_tcon(wdata->cfile->tlink)->ses->server; in cifs_writev_requeue()
2578 &wdata2->cfile); in cifs_writev_requeue()
2579 if (!wdata2->cfile) { in cifs_writev_requeue()
2585 wdata2->pid = wdata2->cfile->pid; in cifs_writev_requeue()
2617 struct inode *inode = d_inode(wdata->cfile->dentry); in cifs_writev_complete()
2623 cifs_stats_bytes_written(tlink_tcon(wdata->cfile->tlink), in cifs_writev_complete()
2839 struct cifsFileInfo *cfile = NULL; in cifs_write_back_from_locked_folio() local
2856 rc = cifs_get_writable_file(CIFS_I(inode), FIND_WR_ANY, &cfile); in cifs_write_back_from_locked_folio()
2875 wdata->pid = cfile->pid; in cifs_write_back_from_locked_folio()
2877 wdata->cfile = cfile; in cifs_write_back_from_locked_folio()
2879 cfile = NULL; in cifs_write_back_from_locked_folio()
2925 if (wdata->cfile->invalidHandle) in cifs_write_back_from_locked_folio()
2945 if (cfile) in cifs_write_back_from_locked_folio()
2946 cifsFileInfo_put(cfile); in cifs_write_back_from_locked_folio()
3172 struct cifsFileInfo *cfile = file->private_data; in cifs_write_end() local
3173 struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); in cifs_write_end()
3178 pid = cfile->pid; in cifs_write_end()
3204 rc = cifs_write(cfile, pid, page_data + offset, copied, &pos); in cifs_write_end()
3376 struct inode *inode = d_inode(wdata->cfile->dentry); in cifs_uncached_writev_complete()
3401 if (wdata->cfile->invalidHandle) { in cifs_resend_wdata()
3402 rc = cifs_reopen_file(wdata->cfile, false); in cifs_resend_wdata()
3431 if (wdata->cfile->invalidHandle) in cifs_resend_wdata()
3576 wdata->cfile = cifsFileInfo_get(open_file); in cifs_write_from_iter()
3590 if (wdata->cfile->invalidHandle) in cifs_write_from_iter()
3621 struct dentry *dentry = ctx->cfile->dentry; in collect_uncached_write_data()
3624 tcon = tlink_tcon(ctx->cfile->tlink); in collect_uncached_write_data()
3670 ctx->cfile, cifs_sb, &tmp_list, in collect_uncached_write_data()
3703 struct cifsFileInfo *cfile; in __cifs_writev() local
3714 cfile = file->private_data; in __cifs_writev()
3715 tcon = tlink_tcon(cfile->tlink); in __cifs_writev()
3724 ctx->cfile = cifsFileInfo_get(cfile); in __cifs_writev()
3778 cfile, cifs_sb, &ctx->list, ctx); in __cifs_writev()
3838 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; in cifs_writev() local
3841 struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; in cifs_writev()
3855 if (!cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(from), in cifs_writev()
3876 struct cifsFileInfo *cfile = (struct cifsFileInfo *) in cifs_strict_writev() local
3878 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_strict_writev()
3949 if (rdata->cfile) in cifs_readdata_release()
3950 cifsFileInfo_put(rdata->cfile); in cifs_readdata_release()
3982 if (rdata->cfile->invalidHandle) { in cifs_resend_rdata()
3983 rc = cifs_reopen_file(rdata->cfile, true); in cifs_resend_rdata()
4011 if (rdata->cfile->invalidHandle) in cifs_resend_rdata()
4106 rdata->cfile = cifsFileInfo_get(open_file); in cifs_send_async_read()
4120 if (rdata->cfile->invalidHandle) in cifs_send_async_read()
4150 cifs_sb = CIFS_SB(ctx->cfile->dentry->d_sb); in collect_uncached_read_data()
4189 rdata->cfile, cifs_sb, in collect_uncached_read_data()
4232 struct cifsFileInfo *cfile; in __cifs_readv() local
4243 cfile = file->private_data; in __cifs_readv()
4244 tcon = tlink_tcon(cfile->tlink); in __cifs_readv()
4259 ctx->cfile = cifsFileInfo_get(cfile); in __cifs_readv()
4317 rc = cifs_send_async_read(offset, len, cfile, cifs_sb, &ctx->list, ctx); in __cifs_readv()
4371 struct cifsFileInfo *cfile = (struct cifsFileInfo *) in cifs_strict_readv() local
4373 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); in cifs_strict_readv()
4397 if (!cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(to), in cifs_strict_readv()
4737 rdata->cfile = cifsFileInfo_get(open_file); in cifs_readahead()
4755 if (rdata->cfile->invalidHandle) in cifs_readahead()
5014 struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, in cifs_oplock_break() local
5016 struct inode *inode = d_inode(cfile->dentry); in cifs_oplock_break()
5036 server->ops->downgrade_oplock(server, cinode, cfile->oplock_level, in cifs_oplock_break()
5037 cfile->oplock_epoch, &purge_cache); in cifs_oplock_break()
5062 rc = cifs_push_locks(cfile); in cifs_oplock_break()
5076 persistent_fid = cfile->fid.persistent_fid; in cifs_oplock_break()
5077 volatile_fid = cfile->fid.volatile_fid; in cifs_oplock_break()
5078 net_fid = cfile->fid.netfid; in cifs_oplock_break()
5079 oplock_break_cancelled = cfile->oplock_break_cancelled; in cifs_oplock_break()
5081 _cifsFileInfo_put(cfile, false /* do not wait for ourself */, false); in cifs_oplock_break()
5123 struct cifsFileInfo *cfile = swap_file->private_data; in cifs_swap_activate() local
5154 if (cfile) in cifs_swap_activate()
5155 cfile->swapfile = true; in cifs_swap_activate()
5168 struct cifsFileInfo *cfile = file->private_data; in cifs_swap_deactivate() local
5174 if (cfile) in cifs_swap_deactivate()
5175 cfile->swapfile = false; in cifs_swap_deactivate()