Commit aa4495ce authored by Stephen Rothwell's avatar Stephen Rothwell

Merge commit 'cifs/master'

parents de6f3a2a 48541bd3
...@@ -365,8 +365,10 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file) ...@@ -365,8 +365,10 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
/* Release a reference on the file private data */ /* Release a reference on the file private data */
static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file) static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
{ {
if (atomic_dec_and_test(&cifs_file->count)) if (atomic_dec_and_test(&cifs_file->count)) {
iput(cifs_file->pInode);
kfree(cifs_file); kfree(cifs_file);
}
} }
/* /*
...@@ -382,7 +384,6 @@ struct cifsInodeInfo { ...@@ -382,7 +384,6 @@ struct cifsInodeInfo {
unsigned long time; /* jiffies of last update/check of inode */ unsigned long time; /* jiffies of last update/check of inode */
bool clientCanCacheRead:1; /* read oplock */ bool clientCanCacheRead:1; /* read oplock */
bool clientCanCacheAll:1; /* read and writebehind oplock */ bool clientCanCacheAll:1; /* read and writebehind oplock */
bool oplockPending:1;
bool delete_pending:1; /* DELETE_ON_CLOSE is set */ bool delete_pending:1; /* DELETE_ON_CLOSE is set */
u64 server_eof; /* current file size on server */ u64 server_eof; /* current file size on server */
u64 uniqueid; /* server inode number */ u64 uniqueid; /* server inode number */
...@@ -585,9 +586,9 @@ require use of the stronger protocol */ ...@@ -585,9 +586,9 @@ require use of the stronger protocol */
#define CIFSSEC_MUST_LANMAN 0x10010 #define CIFSSEC_MUST_LANMAN 0x10010
#define CIFSSEC_MUST_PLNTXT 0x20020 #define CIFSSEC_MUST_PLNTXT 0x20020
#ifdef CONFIG_CIFS_UPCALL #ifdef CONFIG_CIFS_UPCALL
#define CIFSSEC_MASK 0xAF0AF /* allows weak security but also krb5 */ #define CIFSSEC_MASK 0xBF0BF /* allows weak security but also krb5 */
#else #else
#define CIFSSEC_MASK 0xA70A7 /* current flags supported if weak */ #define CIFSSEC_MASK 0xB70B7 /* current flags supported if weak */
#endif /* UPCALL */ #endif /* UPCALL */
#else /* do not allow weak pw hash */ #else /* do not allow weak pw hash */
#ifdef CONFIG_CIFS_UPCALL #ifdef CONFIG_CIFS_UPCALL
......
...@@ -97,7 +97,7 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, ...@@ -97,7 +97,7 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
extern int cifs_posix_open(char *full_path, struct inode **pinode, extern int cifs_posix_open(char *full_path, struct inode **pinode,
struct super_block *sb, int mode, int oflags, struct super_block *sb, int mode, int oflags,
int *poplock, __u16 *pnetfid, int xid); __u32 *poplock, __u16 *pnetfid, int xid);
extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
FILE_UNIX_BASIC_INFO *info, FILE_UNIX_BASIC_INFO *info,
struct cifs_sb_info *cifs_sb); struct cifs_sb_info *cifs_sb);
......
...@@ -147,7 +147,7 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle, ...@@ -147,7 +147,7 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle,
pCifsFile->netfid = fileHandle; pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->tgid; pCifsFile->pid = current->tgid;
pCifsFile->pInode = newinode; pCifsFile->pInode = igrab(newinode);
pCifsFile->invalidHandle = false; pCifsFile->invalidHandle = false;
pCifsFile->closePend = false; pCifsFile->closePend = false;
mutex_init(&pCifsFile->fh_mutex); mutex_init(&pCifsFile->fh_mutex);
...@@ -180,10 +180,9 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle, ...@@ -180,10 +180,9 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle,
int cifs_posix_open(char *full_path, struct inode **pinode, int cifs_posix_open(char *full_path, struct inode **pinode,
struct super_block *sb, int mode, int oflags, struct super_block *sb, int mode, int oflags,
int *poplock, __u16 *pnetfid, int xid) __u32 *poplock, __u16 *pnetfid, int xid)
{ {
int rc; int rc;
__u32 oplock;
bool write_only = false; bool write_only = false;
FILE_UNIX_BASIC_INFO *presp_data; FILE_UNIX_BASIC_INFO *presp_data;
__u32 posix_flags = 0; __u32 posix_flags = 0;
...@@ -228,7 +227,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, ...@@ -228,7 +227,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
mode &= ~current_umask(); mode &= ~current_umask();
rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode,
pnetfid, presp_data, &oplock, full_path, pnetfid, presp_data, poplock, full_path,
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) if (rc)
...@@ -280,7 +279,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -280,7 +279,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
int rc = -ENOENT; int rc = -ENOENT;
int xid; int xid;
int create_options = CREATE_NOT_DIR; int create_options = CREATE_NOT_DIR;
int oplock = 0; __u32 oplock = 0;
int oflags; int oflags;
bool posix_create = false; bool posix_create = false;
/* /*
...@@ -611,7 +610,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, ...@@ -611,7 +610,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
{ {
int xid; int xid;
int rc = 0; /* to get around spurious gcc warning, set to zero here */ int rc = 0; /* to get around spurious gcc warning, set to zero here */
int oplock = 0; __u32 oplock = 0;
__u16 fileHandle = 0; __u16 fileHandle = 0;
bool posix_open = false; bool posix_open = false;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
......
...@@ -50,7 +50,7 @@ static inline struct cifsFileInfo *cifs_init_private( ...@@ -50,7 +50,7 @@ static inline struct cifsFileInfo *cifs_init_private(
mutex_init(&private_data->lock_mutex); mutex_init(&private_data->lock_mutex);
INIT_LIST_HEAD(&private_data->llist); INIT_LIST_HEAD(&private_data->llist);
private_data->pfile = file; /* needed for writepage */ private_data->pfile = file; /* needed for writepage */
private_data->pInode = inode; private_data->pInode = igrab(inode);
private_data->invalidHandle = false; private_data->invalidHandle = false;
private_data->closePend = false; private_data->closePend = false;
/* Initialize reference count to one. The private data is /* Initialize reference count to one. The private data is
...@@ -123,9 +123,11 @@ static inline int cifs_get_disposition(unsigned int flags) ...@@ -123,9 +123,11 @@ static inline int cifs_get_disposition(unsigned int flags)
} }
/* all arguments to this function must be checked for validity in caller */ /* all arguments to this function must be checked for validity in caller */
static inline int cifs_posix_open_inode_helper(struct inode *inode, static inline int
struct file *file, struct cifsInodeInfo *pCifsInode, cifs_posix_open_inode_helper(struct inode *inode, struct file *file,
struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) struct cifsInodeInfo *pCifsInode,
struct cifsFileInfo *pCifsFile, __u32 oplock,
u16 netfid)
{ {
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
...@@ -279,7 +281,8 @@ client_can_cache: ...@@ -279,7 +281,8 @@ client_can_cache:
int cifs_open(struct inode *inode, struct file *file) int cifs_open(struct inode *inode, struct file *file)
{ {
int rc = -EACCES; int rc = -EACCES;
int xid, oplock; int xid;
__u32 oplock;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
struct cifsFileInfo *pCifsFile; struct cifsFileInfo *pCifsFile;
...@@ -474,7 +477,8 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile) ...@@ -474,7 +477,8 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile)
static int cifs_reopen_file(struct file *file, bool can_flush) static int cifs_reopen_file(struct file *file, bool can_flush)
{ {
int rc = -EACCES; int rc = -EACCES;
int xid, oplock; int xid;
__u32 oplock;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
struct cifsFileInfo *pCifsFile; struct cifsFileInfo *pCifsFile;
......
...@@ -562,21 +562,20 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -562,21 +562,20 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
continue; continue;
cifs_stats_inc(&tcon->num_oplock_brks); cifs_stats_inc(&tcon->num_oplock_brks);
write_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
list_for_each(tmp2, &tcon->openFileList) { list_for_each(tmp2, &tcon->openFileList) {
netfile = list_entry(tmp2, struct cifsFileInfo, netfile = list_entry(tmp2, struct cifsFileInfo,
tlist); tlist);
if (pSMB->Fid != netfile->netfid) if (pSMB->Fid != netfile->netfid)
continue; continue;
write_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
read_unlock(&cifs_tcp_ses_lock); read_unlock(&cifs_tcp_ses_lock);
cFYI(1, ("file id match, oplock break")); cFYI(1, ("file id match, oplock break"));
pCifsInode = CIFS_I(netfile->pInode); pCifsInode = CIFS_I(netfile->pInode);
pCifsInode->clientCanCacheAll = false; pCifsInode->clientCanCacheAll = false;
if (pSMB->OplockLevel == 0) if (pSMB->OplockLevel == 0)
pCifsInode->clientCanCacheRead = false; pCifsInode->clientCanCacheRead = false;
pCifsInode->oplockPending = true;
AllocOplockQEntry(netfile->pInode, AllocOplockQEntry(netfile->pInode,
netfile->netfid, tcon); netfile->netfid, tcon);
cFYI(1, ("about to wake up oplock thread")); cFYI(1, ("about to wake up oplock thread"));
...@@ -585,7 +584,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -585,7 +584,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
return true; return true;
} }
write_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
read_unlock(&cifs_tcp_ses_lock); read_unlock(&cifs_tcp_ses_lock);
cFYI(1, ("No matching file for oplock break")); cFYI(1, ("No matching file for oplock break"));
return true; return true;
......
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