aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-09-12 11:54:28 -0400
committerSteve French <sfrench@us.ibm.com>2009-09-15 15:45:03 -0400
commit590a3fe0e18473a55b0ff48548ba87a2010d7730 (patch)
tree0e5fdfa70ee40a10a5b0df3b85cef3baa0d1b2c6 /fs/cifs
parent20d1752f3d6bd32beb90949559e0d14a0b234445 (diff)
cifs: fix oplock request handling in posix codepath
cifs_posix_open takes a "poplock" argument that's intended to be used in the actual posix open call to set the "Flags" field. It ignores this value however and declares an "oplock" parameter on the stack that it passes uninitialized to the CIFSPOSIXOpen function. Not only does this mean that the oplock request flags are bogus, but the result that's expected to be in that variable is unchanged. Fix this, and also clean up the type of the oplock parameter used. Since it's expected to be __u32, we should use that everywhere and not implicitly cast it from a signed type. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/dir.c9
-rw-r--r--fs/cifs/file.c14
3 files changed, 14 insertions, 11 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index da8fbf565991..bf3ae881b2d5 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -97,7 +97,7 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
97 97
98extern int cifs_posix_open(char *full_path, struct inode **pinode, 98extern int cifs_posix_open(char *full_path, struct inode **pinode,
99 struct super_block *sb, int mode, int oflags, 99 struct super_block *sb, int mode, int oflags,
100 int *poplock, __u16 *pnetfid, int xid); 100 __u32 *poplock, __u16 *pnetfid, int xid);
101extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, 101extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
102 FILE_UNIX_BASIC_INFO *info, 102 FILE_UNIX_BASIC_INFO *info,
103 struct cifs_sb_info *cifs_sb); 103 struct cifs_sb_info *cifs_sb);
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index a6424cfc0121..44f735aa2e3f 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -180,10 +180,9 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle,
180 180
181int cifs_posix_open(char *full_path, struct inode **pinode, 181int cifs_posix_open(char *full_path, struct inode **pinode,
182 struct super_block *sb, int mode, int oflags, 182 struct super_block *sb, int mode, int oflags,
183 int *poplock, __u16 *pnetfid, int xid) 183 __u32 *poplock, __u16 *pnetfid, int xid)
184{ 184{
185 int rc; 185 int rc;
186 __u32 oplock;
187 bool write_only = false; 186 bool write_only = false;
188 FILE_UNIX_BASIC_INFO *presp_data; 187 FILE_UNIX_BASIC_INFO *presp_data;
189 __u32 posix_flags = 0; 188 __u32 posix_flags = 0;
@@ -228,7 +227,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
228 227
229 mode &= ~current_umask(); 228 mode &= ~current_umask();
230 rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, 229 rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode,
231 pnetfid, presp_data, &oplock, full_path, 230 pnetfid, presp_data, poplock, full_path,
232 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 231 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
233 CIFS_MOUNT_MAP_SPECIAL_CHR); 232 CIFS_MOUNT_MAP_SPECIAL_CHR);
234 if (rc) 233 if (rc)
@@ -280,7 +279,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
280 int rc = -ENOENT; 279 int rc = -ENOENT;
281 int xid; 280 int xid;
282 int create_options = CREATE_NOT_DIR; 281 int create_options = CREATE_NOT_DIR;
283 int oplock = 0; 282 __u32 oplock = 0;
284 int oflags; 283 int oflags;
285 bool posix_create = false; 284 bool posix_create = false;
286 /* 285 /*
@@ -611,7 +610,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
611{ 610{
612 int xid; 611 int xid;
613 int rc = 0; /* to get around spurious gcc warning, set to zero here */ 612 int rc = 0; /* to get around spurious gcc warning, set to zero here */
614 int oplock = 0; 613 __u32 oplock = 0;
615 __u16 fileHandle = 0; 614 __u16 fileHandle = 0;
616 bool posix_open = false; 615 bool posix_open = false;
617 struct cifs_sb_info *cifs_sb; 616 struct cifs_sb_info *cifs_sb;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fa7beac8b80e..225d127c960e 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -123,9 +123,11 @@ static inline int cifs_get_disposition(unsigned int flags)
123} 123}
124 124
125/* all arguments to this function must be checked for validity in caller */ 125/* all arguments to this function must be checked for validity in caller */
126static inline int cifs_posix_open_inode_helper(struct inode *inode, 126static inline int
127 struct file *file, struct cifsInodeInfo *pCifsInode, 127cifs_posix_open_inode_helper(struct inode *inode, struct file *file,
128 struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) 128 struct cifsInodeInfo *pCifsInode,
129 struct cifsFileInfo *pCifsFile, __u32 oplock,
130 u16 netfid)
129{ 131{
130 132
131 write_lock(&GlobalSMBSeslock); 133 write_lock(&GlobalSMBSeslock);
@@ -279,7 +281,8 @@ client_can_cache:
279int cifs_open(struct inode *inode, struct file *file) 281int cifs_open(struct inode *inode, struct file *file)
280{ 282{
281 int rc = -EACCES; 283 int rc = -EACCES;
282 int xid, oplock; 284 int xid;
285 __u32 oplock;
283 struct cifs_sb_info *cifs_sb; 286 struct cifs_sb_info *cifs_sb;
284 struct cifsTconInfo *tcon; 287 struct cifsTconInfo *tcon;
285 struct cifsFileInfo *pCifsFile; 288 struct cifsFileInfo *pCifsFile;
@@ -474,7 +477,8 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile)
474static int cifs_reopen_file(struct file *file, bool can_flush) 477static int cifs_reopen_file(struct file *file, bool can_flush)
475{ 478{
476 int rc = -EACCES; 479 int rc = -EACCES;
477 int xid, oplock; 480 int xid;
481 __u32 oplock;
478 struct cifs_sb_info *cifs_sb; 482 struct cifs_sb_info *cifs_sb;
479 struct cifsTconInfo *tcon; 483 struct cifsTconInfo *tcon;
480 struct cifsFileInfo *pCifsFile; 484 struct cifsFileInfo *pCifsFile;