aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /fs/cifs/file.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 429337eb7afe..9b11a8f56f3a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -31,6 +31,7 @@
31#include <linux/task_io_accounting_ops.h> 31#include <linux/task_io_accounting_ops.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/mount.h> 33#include <linux/mount.h>
34#include <linux/slab.h>
34#include <asm/div64.h> 35#include <asm/div64.h>
35#include "cifsfs.h" 36#include "cifsfs.h"
36#include "cifspdu.h" 37#include "cifspdu.h"
@@ -76,8 +77,10 @@ static inline fmode_t cifs_posix_convert_flags(unsigned int flags)
76 reopening a file. They had their effect on the original open */ 77 reopening a file. They had their effect on the original open */
77 if (flags & O_APPEND) 78 if (flags & O_APPEND)
78 posix_flags |= (fmode_t)O_APPEND; 79 posix_flags |= (fmode_t)O_APPEND;
79 if (flags & O_SYNC) 80 if (flags & O_DSYNC)
80 posix_flags |= (fmode_t)O_SYNC; 81 posix_flags |= (fmode_t)O_DSYNC;
82 if (flags & __O_SYNC)
83 posix_flags |= (fmode_t)__O_SYNC;
81 if (flags & O_DIRECTORY) 84 if (flags & O_DIRECTORY)
82 posix_flags |= (fmode_t)O_DIRECTORY; 85 posix_flags |= (fmode_t)O_DIRECTORY;
83 if (flags & O_NOFOLLOW) 86 if (flags & O_NOFOLLOW)
@@ -217,8 +220,8 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
217 cFYI(1, ("inode unchanged on server")); 220 cFYI(1, ("inode unchanged on server"));
218 } else { 221 } else {
219 if (file->f_path.dentry->d_inode->i_mapping) { 222 if (file->f_path.dentry->d_inode->i_mapping) {
220 /* BB no need to lock inode until after invalidate 223 /* BB no need to lock inode until after invalidate
221 since namei code should already have it locked? */ 224 since namei code should already have it locked? */
222 rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); 225 rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
223 if (rc != 0) 226 if (rc != 0)
224 CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; 227 CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc;
@@ -836,8 +839,32 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
836 839
837 } else { 840 } else {
838 /* if rc == ERR_SHARING_VIOLATION ? */ 841 /* if rc == ERR_SHARING_VIOLATION ? */
839 rc = 0; /* do not change lock type to unlock 842 rc = 0;
840 since range in use */ 843
844 if (lockType & LOCKING_ANDX_SHARED_LOCK) {
845 pfLock->fl_type = F_WRLCK;
846 } else {
847 rc = CIFSSMBLock(xid, tcon, netfid, length,
848 pfLock->fl_start, 0, 1,
849 lockType | LOCKING_ANDX_SHARED_LOCK,
850 0 /* wait flag */);
851 if (rc == 0) {
852 rc = CIFSSMBLock(xid, tcon, netfid,
853 length, pfLock->fl_start, 1, 0,
854 lockType |
855 LOCKING_ANDX_SHARED_LOCK,
856 0 /* wait flag */);
857 pfLock->fl_type = F_RDLCK;
858 if (rc != 0)
859 cERROR(1, ("Error unlocking "
860 "previously locked range %d "
861 "during test of lock", rc));
862 rc = 0;
863 } else {
864 pfLock->fl_type = F_WRLCK;
865 rc = 0;
866 }
867 }
841 } 868 }
842 869
843 FreeXid(xid); 870 FreeXid(xid);
@@ -1888,11 +1915,10 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1888 1915
1889int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) 1916int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1890{ 1917{
1891 struct dentry *dentry = file->f_path.dentry;
1892 int rc, xid; 1918 int rc, xid;
1893 1919
1894 xid = GetXid(); 1920 xid = GetXid();
1895 rc = cifs_revalidate(dentry); 1921 rc = cifs_revalidate_file(file);
1896 if (rc) { 1922 if (rc) {
1897 cFYI(1, ("Validation prior to mmap failed, error=%d", rc)); 1923 cFYI(1, ("Validation prior to mmap failed, error=%d", rc));
1898 FreeXid(xid); 1924 FreeXid(xid);
@@ -2287,9 +2313,9 @@ cifs_oplock_break(struct slow_work *work)
2287 if (inode && S_ISREG(inode->i_mode)) { 2313 if (inode && S_ISREG(inode->i_mode)) {
2288#ifdef CONFIG_CIFS_EXPERIMENTAL 2314#ifdef CONFIG_CIFS_EXPERIMENTAL
2289 if (cinode->clientCanCacheAll == 0) 2315 if (cinode->clientCanCacheAll == 0)
2290 break_lease(inode, FMODE_READ); 2316 break_lease(inode, O_RDONLY);
2291 else if (cinode->clientCanCacheRead == 0) 2317 else if (cinode->clientCanCacheRead == 0)
2292 break_lease(inode, FMODE_WRITE); 2318 break_lease(inode, O_WRONLY);
2293#endif 2319#endif
2294 rc = filemap_fdatawrite(inode->i_mapping); 2320 rc = filemap_fdatawrite(inode->i_mapping);
2295 if (cinode->clientCanCacheRead == 0) { 2321 if (cinode->clientCanCacheRead == 0) {