Commit ba00ba64 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: make various routines use the cifsFileInfo->tcon pointer

...where it's available and appropriate.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent d3bf5221
...@@ -589,6 +589,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) ...@@ -589,6 +589,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
/* note that this is called by vfs setlease with the BKL held /* note that this is called by vfs setlease with the BKL held
although I doubt that BKL is needed here in cifs */ although I doubt that BKL is needed here in cifs */
struct inode *inode = file->f_path.dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
struct cifsFileInfo *cfile = file->private_data;
if (!(S_ISREG(inode->i_mode))) if (!(S_ISREG(inode->i_mode)))
return -EINVAL; return -EINVAL;
...@@ -599,8 +600,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) ...@@ -599,8 +600,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
((arg == F_WRLCK) && ((arg == F_WRLCK) &&
(CIFS_I(inode)->clientCanCacheAll))) (CIFS_I(inode)->clientCanCacheAll)))
return generic_setlease(file, arg, lease); return generic_setlease(file, arg, lease);
else if (CIFS_SB(inode->i_sb)->tcon->local_lease && else if (cfile->tcon->local_lease && !CIFS_I(inode)->clientCanCacheRead)
!CIFS_I(inode)->clientCanCacheRead)
/* If the server claims to support oplock on this /* If the server claims to support oplock on this
file, then we still need to check oplock even file, then we still need to check oplock even
if the local_lease mount option is set, but there if the local_lease mount option is set, but there
......
...@@ -461,7 +461,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush) ...@@ -461,7 +461,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
} }
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
tcon = cifs_sb->tcon; tcon = pCifsFile->tcon;
/* can not grab rename sem here because various ops, including /* can not grab rename sem here because various ops, including
those that already have the rename sem can end up causing writepage those that already have the rename sem can end up causing writepage
...@@ -575,7 +575,7 @@ int cifs_close(struct inode *inode, struct file *file) ...@@ -575,7 +575,7 @@ int cifs_close(struct inode *inode, struct file *file)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = pSMBFile->tcon;
if (pSMBFile) { if (pSMBFile) {
struct cifsLockInfo *li, *tmp; struct cifsLockInfo *li, *tmp;
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
...@@ -653,11 +653,7 @@ int cifs_closedir(struct inode *inode, struct file *file) ...@@ -653,11 +653,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
xid = GetXid(); xid = GetXid();
if (pCFileStruct) { if (pCFileStruct) {
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon = pCFileStruct->tcon;
struct cifs_sb_info *cifs_sb =
CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
cFYI(1, "Freeing private data in close dir"); cFYI(1, "Freeing private data in close dir");
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
...@@ -767,7 +763,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) ...@@ -767,7 +763,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
cFYI(1, "Unknown type of lock"); cFYI(1, "Unknown type of lock");
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
tcon = cifs_sb->tcon; tcon = ((struct cifsFileInfo *)file->private_data)->tcon;
if (file->private_data == NULL) { if (file->private_data == NULL) {
rc = -EBADF; rc = -EBADF;
...@@ -960,14 +956,14 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, ...@@ -960,14 +956,14 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
/* cFYI(1, " write %d bytes to offset %lld of %s", write_size, /* cFYI(1, " write %d bytes to offset %lld of %s", write_size,
*poffset, file->f_path.dentry->d_name.name); */ *poffset, file->f_path.dentry->d_name.name); */
if (file->private_data == NULL) if (file->private_data == NULL)
return -EBADF; return -EBADF;
open_file = file->private_data; open_file = file->private_data;
pTcon = open_file->tcon;
rc = generic_write_checks(file, poffset, &write_size, 0); rc = generic_write_checks(file, poffset, &write_size, 0);
if (rc) if (rc)
...@@ -1062,14 +1058,13 @@ static ssize_t cifs_write(struct file *file, const char *write_data, ...@@ -1062,14 +1058,13 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
cFYI(1, "write %zd bytes to offset %lld of %s", write_size, cFYI(1, "write %zd bytes to offset %lld of %s", write_size,
*poffset, file->f_path.dentry->d_name.name); *poffset, file->f_path.dentry->d_name.name);
if (file->private_data == NULL) if (file->private_data == NULL)
return -EBADF; return -EBADF;
open_file = file->private_data; open_file = file->private_data;
pTcon = open_file->tcon;
xid = GetXid(); xid = GetXid();
...@@ -1284,7 +1279,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) ...@@ -1284,7 +1279,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
int rc = -EFAULT; int rc = -EFAULT;
int bytes_written = 0; int bytes_written = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
struct inode *inode; struct inode *inode;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
...@@ -1293,7 +1287,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) ...@@ -1293,7 +1287,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
inode = page->mapping->host; inode = page->mapping->host;
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
offset += (loff_t)from; offset += (loff_t)from;
write_data = kmap(page); write_data = kmap(page);
...@@ -1352,6 +1345,7 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -1352,6 +1345,7 @@ static int cifs_writepages(struct address_space *mapping,
int nr_pages; int nr_pages;
__u64 offset = 0; __u64 offset = 0;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
struct cifsTconInfo *tcon;
struct cifsInodeInfo *cifsi = CIFS_I(mapping->host); struct cifsInodeInfo *cifsi = CIFS_I(mapping->host);
struct page *page; struct page *page;
struct pagevec pvec; struct pagevec pvec;
...@@ -1501,8 +1495,9 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -1501,8 +1495,9 @@ static int cifs_writepages(struct address_space *mapping,
cERROR(1, "No writable handles for inode"); cERROR(1, "No writable handles for inode");
rc = -EBADF; rc = -EBADF;
} else { } else {
tcon = open_file->tcon;
long_op = cifs_write_timeout(cifsi, offset); long_op = cifs_write_timeout(cifsi, offset);
rc = CIFSSMBWrite2(xid, cifs_sb->tcon, rc = CIFSSMBWrite2(xid, tcon,
open_file->netfid, open_file->netfid,
bytes_to_write, offset, bytes_to_write, offset,
&bytes_written, iov, n_iov, &bytes_written, iov, n_iov,
...@@ -1520,8 +1515,7 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -1520,8 +1515,7 @@ static int cifs_writepages(struct address_space *mapping,
else else
set_bit(AS_EIO, &mapping->flags); set_bit(AS_EIO, &mapping->flags);
} else { } else {
cifs_stats_bytes_written(cifs_sb->tcon, cifs_stats_bytes_written(tcon, bytes_written);
bytes_written);
} }
} }
for (i = 0; i < n_iov; i++) { for (i = 0; i < n_iov; i++) {
...@@ -1665,7 +1659,7 @@ int cifs_fsync(struct file *file, int datasync) ...@@ -1665,7 +1659,7 @@ int cifs_fsync(struct file *file, int datasync)
if (rc == 0) { if (rc == 0) {
rc = CIFS_I(inode)->write_behind_rc; rc = CIFS_I(inode)->write_behind_rc;
CIFS_I(inode)->write_behind_rc = 0; CIFS_I(inode)->write_behind_rc = 0;
tcon = CIFS_SB(inode->i_sb)->tcon; tcon = smbfile->tcon;
if (!rc && tcon && smbfile && if (!rc && tcon && smbfile &&
!(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) !(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
...@@ -1750,7 +1744,6 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, ...@@ -1750,7 +1744,6 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
if (file->private_data == NULL) { if (file->private_data == NULL) {
rc = -EBADF; rc = -EBADF;
...@@ -1758,6 +1751,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, ...@@ -1758,6 +1751,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
return rc; return rc;
} }
open_file = file->private_data; open_file = file->private_data;
pTcon = open_file->tcon;
if ((file->f_flags & O_ACCMODE) == O_WRONLY) if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cFYI(1, "attempting read on write only file instance"); cFYI(1, "attempting read on write only file instance");
...@@ -1831,7 +1825,6 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, ...@@ -1831,7 +1825,6 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
if (file->private_data == NULL) { if (file->private_data == NULL) {
rc = -EBADF; rc = -EBADF;
...@@ -1839,6 +1832,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, ...@@ -1839,6 +1832,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
return rc; return rc;
} }
open_file = file->private_data; open_file = file->private_data;
pTcon = open_file->tcon;
if ((file->f_flags & O_ACCMODE) == O_WRONLY) if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cFYI(1, "attempting read on write only file instance"); cFYI(1, "attempting read on write only file instance");
...@@ -1974,7 +1968,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1974,7 +1968,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
} }
open_file = file->private_data; open_file = file->private_data;
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon; pTcon = open_file->tcon;
/* /*
* Reads as many pages as possible from fscache. Returns -ENOBUFS * Reads as many pages as possible from fscache. Returns -ENOBUFS
...@@ -2312,7 +2306,6 @@ void cifs_oplock_break(struct work_struct *work) ...@@ -2312,7 +2306,6 @@ void cifs_oplock_break(struct work_struct *work)
oplock_break); oplock_break);
struct inode *inode = cfile->pInode; struct inode *inode = cfile->pInode;
struct cifsInodeInfo *cinode = CIFS_I(inode); struct cifsInodeInfo *cinode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->mnt->mnt_sb);
int rc, waitrc = 0; int rc, waitrc = 0;
if (inode && S_ISREG(inode->i_mode)) { if (inode && S_ISREG(inode->i_mode)) {
...@@ -2339,7 +2332,7 @@ void cifs_oplock_break(struct work_struct *work) ...@@ -2339,7 +2332,7 @@ void cifs_oplock_break(struct work_struct *work)
* disconnected since oplock already released by the server * disconnected since oplock already released by the server
*/ */
if (!cfile->closePend && !cfile->oplock_break_cancelled) { if (!cfile->closePend && !cfile->oplock_break_cancelled) {
rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0, rc = CIFSSMBLock(0, cfile->tcon, cfile->netfid, 0, 0, 0, 0,
LOCKING_ANDX_OPLOCK_RELEASE, false); LOCKING_ANDX_OPLOCK_RELEASE, false);
cFYI(1, "Oplock release rc = %d", rc); cFYI(1, "Oplock release rc = %d", rc);
} }
......
...@@ -288,8 +288,8 @@ int cifs_get_file_info_unix(struct file *filp) ...@@ -288,8 +288,8 @@ int cifs_get_file_info_unix(struct file *filp)
struct cifs_fattr fattr; struct cifs_fattr fattr;
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *tcon = cifs_sb->tcon;
struct cifsFileInfo *cfile = filp->private_data; struct cifsFileInfo *cfile = filp->private_data;
struct cifsTconInfo *tcon = cfile->tcon;
xid = GetXid(); xid = GetXid();
rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data); rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data);
...@@ -522,8 +522,8 @@ int cifs_get_file_info(struct file *filp) ...@@ -522,8 +522,8 @@ int cifs_get_file_info(struct file *filp)
struct cifs_fattr fattr; struct cifs_fattr fattr;
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *tcon = cifs_sb->tcon;
struct cifsFileInfo *cfile = filp->private_data; struct cifsFileInfo *cfile = filp->private_data;
struct cifsTconInfo *tcon = cfile->tcon;
xid = GetXid(); xid = GetXid();
rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data);
...@@ -891,7 +891,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, ...@@ -891,7 +891,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon;
FILE_BASIC_INFO info_buf; FILE_BASIC_INFO info_buf;
if (attrs == NULL) if (attrs == NULL)
...@@ -934,9 +934,12 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, ...@@ -934,9 +934,12 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
if (open_file) { if (open_file) {
netfid = open_file->netfid; netfid = open_file->netfid;
netpid = open_file->pid; netpid = open_file->pid;
pTcon = open_file->tcon;
goto set_via_filehandle; goto set_via_filehandle;
} }
pTcon = cifs_sb->tcon;
/* /*
* NT4 apparently returns success on this call, but it doesn't * NT4 apparently returns success on this call, but it doesn't
* really work. * really work.
...@@ -1611,11 +1614,12 @@ int cifs_revalidate_file(struct file *filp) ...@@ -1611,11 +1614,12 @@ int cifs_revalidate_file(struct file *filp)
{ {
int rc = 0; int rc = 0;
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
if (!cifs_inode_needs_reval(inode)) if (!cifs_inode_needs_reval(inode))
goto check_inval; goto check_inval;
if (CIFS_SB(inode->i_sb)->tcon->unix_ext) if (cfile->tcon->unix_ext)
rc = cifs_get_file_info_unix(filp); rc = cifs_get_file_info_unix(filp);
else else
rc = cifs_get_file_info(filp); rc = cifs_get_file_info(filp);
...@@ -1720,7 +1724,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1720,7 +1724,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = NULL;
/* /*
* To avoid spurious oplock breaks from server, in the case of * To avoid spurious oplock breaks from server, in the case of
...@@ -1735,6 +1739,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1735,6 +1739,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
if (open_file) { if (open_file) {
__u16 nfid = open_file->netfid; __u16 nfid = open_file->netfid;
__u32 npid = open_file->pid; __u32 npid = open_file->pid;
pTcon = open_file->tcon;
rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid, rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid,
npid, false); npid, false);
cifsFileInfo_put(open_file); cifsFileInfo_put(open_file);
...@@ -1749,6 +1754,9 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1749,6 +1754,9 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
rc = -EINVAL; rc = -EINVAL;
if (rc != 0) { if (rc != 0) {
if (pTcon == NULL)
pTcon = cifs_sb->tcon;
/* Set file size by pathname rather than by handle /* Set file size by pathname rather than by handle
either because no valid, writeable file handle for either because no valid, writeable file handle for
it was found or because there was an error setting it was found or because there was an error setting
...@@ -1798,7 +1806,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) ...@@ -1798,7 +1806,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
struct inode *inode = direntry->d_inode; struct inode *inode = direntry->d_inode;
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon;
struct cifs_unix_set_info_args *args = NULL; struct cifs_unix_set_info_args *args = NULL;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
...@@ -1889,9 +1897,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) ...@@ -1889,9 +1897,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
if (open_file) { if (open_file) {
u16 nfid = open_file->netfid; u16 nfid = open_file->netfid;
u32 npid = open_file->pid; u32 npid = open_file->pid;
pTcon = open_file->tcon;
rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid);
cifsFileInfo_put(open_file); cifsFileInfo_put(open_file);
} else { } else {
pTcon = cifs_sb->tcon;
rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
......
...@@ -37,11 +37,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) ...@@ -37,11 +37,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
struct cifsFileInfo *pSMBFile = filep->private_data;
struct cifsTconInfo *tcon = pSMBFile->tcon;
__u64 ExtAttrBits = 0; __u64 ExtAttrBits = 0;
__u64 ExtAttrMask = 0; __u64 ExtAttrMask = 0;
__u64 caps; __u64 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
struct cifsTconInfo *tcon;
struct cifsFileInfo *pSMBFile = filep->private_data;
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
xid = GetXid(); xid = GetXid();
...@@ -50,17 +50,6 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) ...@@ -50,17 +50,6 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
#ifdef CONFIG_CIFS_POSIX
tcon = cifs_sb->tcon;
if (tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else {
rc = -EIO;
FreeXid(xid);
return -EIO;
}
#endif /* CONFIG_CIFS_POSIX */
switch (command) { switch (command) {
case CIFS_IOC_CHECKUMOUNT: case CIFS_IOC_CHECKUMOUNT:
cFYI(1, "User unmount attempted"); cFYI(1, "User unmount attempted");
......
...@@ -228,22 +228,21 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -228,22 +228,21 @@ static int initiate_cifs_search(const int xid, struct file *file)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
if (file->private_data == NULL) { cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
if (cifs_sb == NULL)
return -EINVAL;
if (file->private_data == NULL)
file->private_data = file->private_data =
kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
}
if (file->private_data == NULL) if (file->private_data == NULL)
return -ENOMEM; return -ENOMEM;
cifsFile = file->private_data; cifsFile = file->private_data;
cifsFile->invalidHandle = true; cifsFile->invalidHandle = true;
cifsFile->srch_inf.endOfSearch = false; cifsFile->srch_inf.endOfSearch = false;
cifsFile->tcon = cifs_sb->tcon;
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); pTcon = cifsFile->tcon;
if (cifs_sb == NULL)
return -EINVAL;
pTcon = cifs_sb->tcon;
if (pTcon == NULL) if (pTcon == NULL)
return -EINVAL; return -EINVAL;
...@@ -786,9 +785,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -786,9 +785,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon;
if (pTcon == NULL)
return -EINVAL;
switch ((int) file->f_pos) { switch ((int) file->f_pos) {
case 0: case 0:
...@@ -838,6 +834,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -838,6 +834,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
CIFSFindClose(xid, pTcon, cifsFile->netfid); CIFSFindClose(xid, pTcon, cifsFile->netfid);
} */ } */
pTcon = cifsFile->tcon;
rc = find_cifs_entry(xid, pTcon, file, rc = find_cifs_entry(xid, pTcon, file,
&current_entry, &num_to_fill); &current_entry, &num_to_fill);
if (rc) { if (rc) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment