aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b4a18c1cab0a..616b140534be 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -201,7 +201,7 @@ int cifs_open(struct inode *inode, struct file *file)
201 } else { 201 } else {
202 if (file->f_flags & O_EXCL) 202 if (file->f_flags & O_EXCL)
203 cERROR(1, ("could not find file instance for " 203 cERROR(1, ("could not find file instance for "
204 "new file %p ", file)); 204 "new file %p", file));
205 } 205 }
206 } 206 }
207 207
@@ -260,10 +260,15 @@ int cifs_open(struct inode *inode, struct file *file)
260 rc = -ENOMEM; 260 rc = -ENOMEM;
261 goto out; 261 goto out;
262 } 262 }
263 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, 263
264 CREATE_NOT_DIR, &netfid, &oplock, buf, 264 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
265 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
266 desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
265 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags 267 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
266 & CIFS_MOUNT_MAP_SPECIAL_CHR); 268 & CIFS_MOUNT_MAP_SPECIAL_CHR);
269 else
270 rc = -EIO; /* no NT SMB support fall into legacy open below */
271
267 if (rc == -EIO) { 272 if (rc == -EIO) {
268 /* Old server, try legacy style OpenX */ 273 /* Old server, try legacy style OpenX */
269 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 274 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
@@ -272,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file)
272 & CIFS_MOUNT_MAP_SPECIAL_CHR); 277 & CIFS_MOUNT_MAP_SPECIAL_CHR);
273 } 278 }
274 if (rc) { 279 if (rc) {
275 cFYI(1, ("cifs_open returned 0x%x ", rc)); 280 cFYI(1, ("cifs_open returned 0x%x", rc));
276 goto out; 281 goto out;
277 } 282 }
278 file->private_data = 283 file->private_data =
@@ -409,8 +414,8 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
409 CIFS_MOUNT_MAP_SPECIAL_CHR); 414 CIFS_MOUNT_MAP_SPECIAL_CHR);
410 if (rc) { 415 if (rc) {
411 up(&pCifsFile->fh_sem); 416 up(&pCifsFile->fh_sem);
412 cFYI(1, ("cifs_open returned 0x%x ", rc)); 417 cFYI(1, ("cifs_open returned 0x%x", rc));
413 cFYI(1, ("oplock: %d ", oplock)); 418 cFYI(1, ("oplock: %d", oplock));
414 } else { 419 } else {
415 pCifsFile->netfid = netfid; 420 pCifsFile->netfid = netfid;
416 pCifsFile->invalidHandle = FALSE; 421 pCifsFile->invalidHandle = FALSE;
@@ -531,7 +536,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
531 (struct cifsFileInfo *)file->private_data; 536 (struct cifsFileInfo *)file->private_data;
532 char *ptmp; 537 char *ptmp;
533 538
534 cFYI(1, ("Closedir inode = 0x%p with ", inode)); 539 cFYI(1, ("Closedir inode = 0x%p", inode));
535 540
536 xid = GetXid(); 541 xid = GetXid();
537 542
@@ -605,7 +610,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
605 } 610 }
606 if (pfLock->fl_flags & FL_ACCESS) 611 if (pfLock->fl_flags & FL_ACCESS)
607 cFYI(1, ("Process suspended by mandatory locking - " 612 cFYI(1, ("Process suspended by mandatory locking - "
608 "not implemented yet ")); 613 "not implemented yet"));
609 if (pfLock->fl_flags & FL_LEASE) 614 if (pfLock->fl_flags & FL_LEASE)
610 cFYI(1, ("Lease on file - not implemented yet")); 615 cFYI(1, ("Lease on file - not implemented yet"));
611 if (pfLock->fl_flags & 616 if (pfLock->fl_flags &
@@ -1375,7 +1380,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1375 1380
1376 xid = GetXid(); 1381 xid = GetXid();
1377 1382
1378 cFYI(1, ("Sync file - name: %s datasync: 0x%x ", 1383 cFYI(1, ("Sync file - name: %s datasync: 0x%x",
1379 dentry->d_name.name, datasync)); 1384 dentry->d_name.name, datasync));
1380 1385
1381 rc = filemap_fdatawrite(inode->i_mapping); 1386 rc = filemap_fdatawrite(inode->i_mapping);
@@ -1404,7 +1409,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1404/* fill in rpages then 1409/* fill in rpages then
1405 result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */ 1410 result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */
1406 1411
1407/* cFYI(1, ("rpages is %d for sync page of Index %ld ", rpages, index)); 1412/* cFYI(1, ("rpages is %d for sync page of Index %ld", rpages, index));
1408 1413
1409#if 0 1414#if 0
1410 if (rc < 0) 1415 if (rc < 0)
@@ -1836,7 +1841,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
1836 if (rc < 0) 1841 if (rc < 0)
1837 goto io_error; 1842 goto io_error;
1838 else 1843 else
1839 cFYI(1, ("Bytes read %d ",rc)); 1844 cFYI(1, ("Bytes read %d",rc));
1840 1845
1841 file->f_dentry->d_inode->i_atime = 1846 file->f_dentry->d_inode->i_atime =
1842 current_fs_time(file->f_dentry->d_inode->i_sb); 1847 current_fs_time(file->f_dentry->d_inode->i_sb);
@@ -1957,3 +1962,19 @@ struct address_space_operations cifs_addr_ops = {
1957 /* .sync_page = cifs_sync_page, */ 1962 /* .sync_page = cifs_sync_page, */
1958 /* .direct_IO = */ 1963 /* .direct_IO = */
1959}; 1964};
1965
1966/*
1967 * cifs_readpages requires the server to support a buffer large enough to
1968 * contain the header plus one complete page of data. Otherwise, we need
1969 * to leave cifs_readpages out of the address space operations.
1970 */
1971struct address_space_operations cifs_addr_ops_smallbuf = {
1972 .readpage = cifs_readpage,
1973 .writepage = cifs_writepage,
1974 .writepages = cifs_writepages,
1975 .prepare_write = cifs_prepare_write,
1976 .commit_write = cifs_commit_write,
1977 .set_page_dirty = __set_page_dirty_nobuffers,
1978 /* .sync_page = cifs_sync_page, */
1979 /* .direct_IO = */
1980};